1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-18 02:00:20 +02:00

http: Accept empty reason phrases.

Fixes <http://bugs.gnu.org/22273>.
Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>.

* module/web/http.scm (read-header-line): New procedure.
(read-response-line): Use it instead of 'read-line*'.
* test-suite/tests/web-http.test ("read-response-line"): Add test.
This commit is contained in:
Ludovic Courtès 2016-01-06 14:56:00 +01:00
parent 5df0822b7c
commit 4c7732c59e
2 changed files with 27 additions and 8 deletions

View file

@ -1,6 +1,6 @@
;;;; web-http.test --- HTTP library -*- mode: scheme; coding: utf-8; -*-
;;;;
;;;; Copyright (C) 2010, 2011, 2014, 2015 Free Software Foundation, Inc.
;;;; Copyright (C) 2010, 2011, 2014, 2015, 2016 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -194,7 +194,11 @@
(pass-if-read-response-line "HTTP/1.0 404 Not Found"
(1 . 0) 404 "Not Found")
(pass-if-read-response-line "HTTP/1.1 200 OK"
(1 . 1) 200 "OK"))
(1 . 1) 200 "OK")
;; Empty reason phrases are valid; see <http://bugs.gnu.org/22273>.
(pass-if-read-response-line "HTTP/1.1 302 "
(1 . 1) 302 ""))
(with-test-prefix "write-response-line"
(pass-if-write-response-line "HTTP/1.0 404 Not Found"