From 192458eb3c4e1d1a31f9b84ac4b2cca43fdc3e1c Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Thu, 12 Sep 2024 12:15:05 +0200 Subject: Update intarweb for CHICKEN 6 This is now using read-bytevector instead of read-string, and the custom port constructor uses keyword arguments now. Don't bother to use cond-expand to make it compatible with C5. Instead, we can cut new C5 releases from the intarweb-2.x branch if necessary. --- intarweb.scm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'intarweb.scm') diff --git a/intarweb.scm b/intarweb.scm index ffea2a2..d2cca10 100644 --- a/intarweb.scm +++ b/intarweb.scm @@ -100,7 +100,7 @@ basic-auth-param-subunparser digest-auth-param-subunparser ) -(import scheme (chicken base) (chicken foreign) (chicken irregex) +(import scheme (scheme base) (chicken base) (chicken foreign) (chicken irregex) (chicken format) (chicken io) (chicken string) (chicken time posix) (chicken pathname) (chicken fixnum) (chicken condition) (chicken port) (chicken syntax) @@ -153,8 +153,8 @@ ;; that deal with headers. (define-record headers v) -(define-record-printer (headers h out) - (fprintf out "#(headers: ~S)" (headers-v h))) +(set-record-printer! headers (lambda (h out) + (fprintf out "#(headers: ~S)" (headers-v h)))) (define headers->list headers-v) @@ -271,7 +271,7 @@ (fprintf port "~X\r\n~A\r\n" len s)))) (lambda () ; close (close-output-port port)) - (lambda () ; flush + force-output: (lambda () (flush-output port))))) ;; first "reserved" slot ;; Slot 7 should probably stay 'custom @@ -312,12 +312,12 @@ (or (not position) (char-ready? port))) (lambda () ; close (close-input-port port)) - (lambda () ; peek-char + peek-char: (lambda () (check-position) (if position (peek-char port) #!eof)) - (lambda (p bytes buf off) ; read-string! + read-bytevector: (lambda (p bytes buf off) (let lp ((todo bytes) (total-bytes-read 0) (off off)) @@ -325,7 +325,7 @@ (if (or (not position) (= todo 0)) total-bytes-read (let* ((n (min todo (- chunk-length position))) - (bytes-read (read-string! n buf port off))) + (bytes-read (read-bytevector! buf port off (+ off n)))) (set! position (+ position bytes-read)) (lp (- todo bytes-read) (+ total-bytes-read bytes-read) -- cgit v1.2.3