diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-01-06 17:15:20 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-05-22 20:02:37 +0200 |
commit | 66bc464542808a7038662f0a4ea932f3eabcf2ca (patch) | |
tree | 7c370c1683c794ec3f0eb97a5decda726423dd16 /module/web/http.scm | |
parent | f53145d41cbf6908959e230dc53cfccf38d92380 (diff) | |
download | guile-66bc464542808a7038662f0a4ea932f3eabcf2ca.tar.gz |
http: Use 'read-header-line' instead of 'read-line*'.
* module/web/http.scm (read-line*): Remove.
(read-continuation-line, read-header, read-request-line): Use
'read-header-line' instead of 'read-line*'.
Diffstat (limited to 'module/web/http.scm')
-rw-r--r-- | module/web/http.scm | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/module/web/http.scm b/module/web/http.scm index f46c384ce..0bcd9058b 100644 --- a/module/web/http.scm +++ b/module/web/http.scm @@ -159,28 +159,12 @@ or if EOF is reached." ((line . _) ;EOF or missing delimiter (bad-header 'read-header-line line)))) -(define* (read-line* port) - (let* ((pair (%read-line port)) - (line (car pair)) - (delim (cdr pair))) - (if (and (string? line) (char? delim)) - (let ((orig-len (string-length line))) - (let lp ((len orig-len)) - (if (and (> len 0) - (char-whitespace? (string-ref line (1- len)))) - (lp (1- len)) - (if (= len orig-len) - line - (substring line 0 len))))) - (bad-header '%read line)))) - (define (read-continuation-line port val) (if (or (eqv? (peek-char port) #\space) (eqv? (peek-char port) #\tab)) (read-continuation-line port (string-append val - (begin - (read-line* port)))) + (read-header-line port))) val)) (define *eof* (call-with-input-string "" read)) @@ -192,7 +176,7 @@ was known but the value was invalid. Returns the end-of-file object for both values if the end of the message body was reached (i.e., a blank line)." - (let ((line (read-line* port))) + (let ((line (read-header-line port))) (if (or (string-null? line) (string=? line "\r")) (values *eof* *eof*) @@ -1101,7 +1085,7 @@ not have to have a scheme or host name. The result is a URI object." (define (read-request-line port) "Read the first line of an HTTP request from PORT, returning three values: the method, the URI, and the version." - (let* ((line (read-line* port)) + (let* ((line (read-header-line port)) (d0 (string-index line char-set:whitespace)) ; "delimiter zero" (d1 (string-rindex line char-set:whitespace))) (if (and d0 d1 (< d0 d1)) |