Index: socket.scm =================================================================== --- socket.scm (revision 31093) +++ socket.scm (working copy) @@ -1157,26 +1157,29 @@ (let loop ((str #f) (limit (or limit (##sys#fudge 21)))) (cond ((fx< bufindex buflen) - (##sys#scan-buffer-line - buf - (fxmin buflen limit) - bufindex - (lambda (pos2 next) - (let* ((len (fx- pos2 bufindex)) - (dest (##sys#make-string len))) - (##core#inline "C_substring_copy" buf dest bufindex pos2 0) - (set! bufindex next) - (cond ((eq? pos2 limit) ; no line-terminator, hit limit - (if str (##sys#string-append str dest) dest)) - ((eq? pos2 next) ; no line-terminator, hit buflen - (read-input) - (if (fx>= bufindex buflen) - (or str "") - (loop (if str (##sys#string-append str dest) dest) - (fx- limit len)) ) ) - (else - (##sys#setislot p 4 (fx+ (##sys#slot p 4) 1)) - (if str (##sys#string-append str dest) dest)) ) ) ) ) ) + (receive (next line full-line?) + (##sys#scan-buffer-line + buf + (fxmin buflen limit) + bufindex + (lambda (pos2 next) + (let* ((len (fx- pos2 bufindex)) + (dest (##sys#make-string len))) + (##core#inline "C_substring_copy" buf dest bufindex pos2 0) + (set! bufindex next) + (cond ((eq? pos2 limit) ; no line-terminator, hit limit + (if str (##sys#string-append str dest) dest)) + ((eq? pos2 next) ; no line-terminator, hit buflen + (read-input) + (if (fx>= bufindex buflen) + (or str "") + (loop (if str (##sys#string-append str dest) dest) + (fx- limit len)) ) ) + (else + (##sys#setislot p 4 (fx+ (##sys#slot p 4) 1)) + (if str (##sys#string-append str dest) dest)) ) ) ) ) + (set! bufindex next) + line) ) (else (read-input) (if (fx< bufindex buflen)