summaryrefslogtreecommitdiff
path: root/intarweb.scm
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2024-09-12 12:15:05 +0200
committerPeter Bex <peter@more-magic.net>2024-09-12 12:15:05 +0200
commit192458eb3c4e1d1a31f9b84ac4b2cca43fdc3e1c (patch)
treee1e72ffcf584b427e163a39bdb66ef46bfd8d3c8 /intarweb.scm
parente3940c300b993bd1256bdff3758d9c421d664ac7 (diff)
downloadintarweb-192458eb3c4e1d1a31f9b84ac4b2cca43fdc3e1c.tar.gz
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.
Diffstat (limited to 'intarweb.scm')
-rw-r--r--intarweb.scm14
1 files changed, 7 insertions, 7 deletions
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)