[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 42/47: http: Use 'read-header-line' instead of 'read-lin
From: |
Andy Wingo |
Subject: |
[Guile-commits] 42/47: http: Use 'read-header-line' instead of 'read-line*'. |
Date: |
Sun, 22 May 2016 18:23:06 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit 66bc464542808a7038662f0a4ea932f3eabcf2ca
Author: Ludovic Courtès <address@hidden>
Date: Wed Jan 6 17:15:20 2016 +0100
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*'.
---
module/web/http.scm | 22 +++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)
diff --git a/module/web/http.scm b/module/web/http.scm
index f46c384..0bcd905 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))
- [Guile-commits] 15/47: i18n: Check for non-POSIX strtol_l., (continued)
- [Guile-commits] 15/47: i18n: Check for non-POSIX strtol_l., Andy Wingo, 2016/05/22
- [Guile-commits] 28/47: i18n: Add new collation test for posterity., Andy Wingo, 2016/05/22
- [Guile-commits] 05/47: tests: Make 'test-guild-compile' more reliable., Andy Wingo, 2016/05/22
- [Guile-commits] 32/47: Remove SIGEV constant definitions., Andy Wingo, 2016/05/22
- [Guile-commits] 04/47: Don't return expressions from void functions in numbers.c, Andy Wingo, 2016/05/22
- [Guile-commits] 31/47: Add Hurd signal and error constants., Andy Wingo, 2016/05/22
- [Guile-commits] 08/47: web: Export 'server-impl' procedures and the 'http' server implementation., Andy Wingo, 2016/05/22
- [Guile-commits] 39/47: Bump user-visible copyright years to 2015., Andy Wingo, 2016/05/22
- [Guile-commits] 43/47: SRFI-19: Update the table of leap seconds., Andy Wingo, 2016/05/22
- [Guile-commits] 41/47: http: Accept empty reason phrases., Andy Wingo, 2016/05/22
- [Guile-commits] 42/47: http: Use 'read-header-line' instead of 'read-line*'.,
Andy Wingo <=
- [Guile-commits] 47/47: Merge from stable-2.0, Andy Wingo, 2016/05/22
- [Guile-commits] 14/47: Fix typo in the man page., Andy Wingo, 2016/05/22
- [Guile-commits] 33/47: build: Remove libguile/mkstemp.c, redundant with Gnulib., Andy Wingo, 2016/05/22
- [Guile-commits] 37/47: Regenerate SRFI-14 character set data., Andy Wingo, 2016/05/22
- [Guile-commits] 34/47: Thank David and Kouhei., Andy Wingo, 2016/05/22
- [Guile-commits] 18/47: Heed the reader settings implied by #!r6rs, Andy Wingo, 2016/05/22
- [Guile-commits] 38/47: Fix getsockopt/setsockopt handling of SO_SNDBUF/SO_RCVBUF options., Andy Wingo, 2016/05/22
- [Guile-commits] 24/47: Thank Ricardo., Andy Wingo, 2016/05/22