diff options
author | Peter Bex <peter@more-magic.net> | 2024-09-13 19:50:03 +0200 |
---|---|---|
committer | Peter Bex <peter@more-magic.net> | 2024-09-13 19:50:03 +0200 |
commit | 299eef8c087b48de8609f6b66d2d31d17dc0cc37 (patch) | |
tree | 5fe115f5f2125c52f4512d5c3122c16889b6a4df | |
parent | 36f623a790d1cc90534dfdd3a0a4ffc3f64977a3 (diff) | |
download | http-client-299eef8c087b48de8609f6b66d2d31d17dc0cc37.tar.gz |
-rw-r--r-- | http-client.release-info | 7 | ||||
-rw-r--r-- | http-client.scm | 12 | ||||
-rw-r--r-- | tests/run.scm | 10 | ||||
-rw-r--r-- | tests/testlib.scm | 2 |
4 files changed, 16 insertions, 15 deletions
diff --git a/http-client.release-info b/http-client.release-info index 5362832..82afc87 100644 --- a/http-client.release-info +++ b/http-client.release-info @@ -1,8 +1,3 @@ (repo git "https://code.more-magic.net/{egg-name}") (uri targz "https://code.more-magic.net/{egg-name}/snapshot/{egg-name}-{egg-release}.tar.gz") -(release "1.0") -(release "1.1") -(release "1.1.1") -(release "1.2") -(release "1.2.1") -(release "1.2.2") +(release "2.0") diff --git a/http-client.scm b/http-client.scm index 58d045d..a0cf59f 100644 --- a/http-client.scm +++ b/http-client.scm @@ -46,7 +46,7 @@ server-connector default-server-connector prepare-request default-prepare-request) -(import scheme +(import scheme (scheme base) srfi-1 srfi-13 srfi-18 srfi-69 (chicken base) (chicken string) (chicken time) (chicken sort) (chicken io) (chicken file posix) (chicken format) @@ -295,16 +295,16 @@ (or (= pos len) (char-ready? port))) (lambda () ; close (close-input-port port)) - (lambda () ; peek-char + peek-char: (lambda () (if (= pos len) #!eof (peek-char port))) - (lambda (p bytes buf off) ; read-string! + read-bytevector: (lambda (p bytes buf off) (let* ((bytes (min bytes (- len pos))) - (bytes-read (read-string! bytes buf port off))) + (bytes-read (read-bytevector! buf port off (+ off bytes)))) (set! pos (+ pos bytes-read)) bytes-read)) - (lambda (p limit) ; read-line + read-line: (lambda (p limit) (if (= pos len) #!eof (let* ((bytes-left (- len pos)) @@ -772,7 +772,7 @@ (let ((size (##sys#slot port 11)) (string (##sys#slot port 12))) (assert (integer? size)) ; Check our assumptions; this is pretty unsafe code - (assert (string? string)) + (assert (bytevector? string)) size))) (define (calculate-chunk-size entries) diff --git a/tests/run.scm b/tests/run.scm index 7759b24..9ad7fd8 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -304,7 +304,10 @@ (test-group "alist form data body with custom port" (let* ((string-port (open-input-string "the file's contents")) - (custom-port (make-input-port (lambda () (read-char string-port)) (constantly #t) (lambda () (close-input-port string-port)))) + (custom-port (make-input-port (lambda () (read-char string-port)) + (constantly #t) + (lambda () (close-input-port string-port)) + read-bytevector: (lambda (p bytes buf off) (read-bytevector! buf string-port off bytes)))) (log (with-server-response (lambda () (with-input-from-request @@ -350,7 +353,10 @@ (test-group "alist form data body with custom port using HTTP/1.0" (let* ((string-port (open-input-string "the file's contents")) - (custom-port (make-input-port (lambda () (read-char string-port)) (constantly #t) (lambda () (close-input-port string-port)))) + (custom-port (make-input-port (lambda () (read-char string-port)) + (constantly #t) + (lambda () (close-input-port string-port)) + read-bytevector: (lambda (p bytes buf off) (read-bytevector! buf string-port off bytes)))) (uri (uri-reference "http://example.com")) (req (make-request uri: uri method: 'POST major: 1 minor: 0)) diff --git a/tests/testlib.scm b/tests/testlib.scm index 92e69da..e50e5da 100644 --- a/tests/testlib.scm +++ b/tests/testlib.scm @@ -3,7 +3,7 @@ ;; TODO: Test HTTPS somehow? -(import test uri-common intarweb srfi-1 srfi-18 (chicken tcp) +(import (scheme base) test uri-common intarweb srfi-1 srfi-18 (chicken tcp) (chicken string) (chicken io) (chicken file) (chicken format)) ;; From intarweb |