From: Robert Marlow [EMAIL PROTECTED]
Date: Wed, 14 Jul 2004 15:38:17 +0800
I happened accross a bug in the HTTP module of guile-www which seemed to
trigger when I visited a page which gave no headers and just whitespace
in the body. In such a case the variable second of parse-status-line
gets bound to #f which messes up the later make-shared-substrings which
use it.
in the status line (which has the form: VERSION CODE TEXT), i believe
TEXT is optional, but i don't have the http spec (RFC 2616) handy to
confirm this. if TEXT is actually optional, that indicates a bug in
http.scm. if TEXT is required, that indicates a bug in the server's
http implementation.
note that the status line cannot be omitted altogether; the most minimal
valid HTTP response a server can send is STATUS-LINE, CRLF, CRLF. you
may wish to check the server response for conformance using a command
like w3m -dump_head or similar.
[patch]
unfortunately the patch is incorrect because it allows the possibility
to derive #f for CODE, which is illegal (CODE must be a 3-digit sequence
like 404 or 200). assuming TEXT is indeed optional, i have changed
`parse-status-line' (in cvs) to handle a missing TEXT component by
returning the empty string. the proc now reads as follows:
(define (parse-status-line statline)
;; Handle: VERSION CODE
;; as well as: VERSION CODE TEXT
;; For the former, use the null string for TEXT.
(let* ((first (string-index statline #\space))
(second (string-index statline #\space (1+ first
(list (make-shared-substring statline 0 first)
(make-shared-substring statline (1+ first)
(or second (string-length statline)))
(if second
(make-shared-substring statline (1+ second))
and will appear in guile-www 2.6 (to be released shortly).
thi
___
Bug-guile mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-guile