(let ((buffer (make-bytevector 4096)))
(let loop ()
(let ((n-read (read-bytevector! buffer input-port)))
- (if (> n-read 0)
+ (if (exact-positive-integer? n-read)
(begin
(encode-base64:update context buffer 0 n-read)
(loop))))))))
(nread (read-bytevector! buffer port)))
;; Check to make sure that the length didn't change under us
;; while we were reading. If it did, this is no good.
- (and (= nread length)
+ (and (eqv? nread length)
(object-new-type type-code:legacy-string buffer))))))
(define (string-port/position port)
(let loop ((n n))
(if (> n 0)
(let ((m (read-bytevector! buffer port 0 (min n len))))
- (if (= m 0)
+ (if (not (exact-positive-integer? m))
(error "Premature EOF in HTTP message body."))
(do ((i 0 (+ i 1)))
((not (< i m)))
(let ((buffer (make-bytevector #x1000)))
(let loop ()
(let ((n (read-bytevector! buffer port)))
- (if (> n 0)
+ (if (exact-positive-integer? n)
(begin
(do ((i 0 (+ i 1)))
((not (< i n)))