summaryrefslogtreecommitdiff
path: root/test-suite/tests/web-http.test
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-09-26 11:04:23 +0200
committerAndy Wingo <wingo@pobox.com>2016-05-22 19:49:33 +0200
commit0bcf5d78ecb40871fb48cf0f1a6065be38a3a14b (patch)
tree5509f801ba9ed79eccc40cb7624b1581b633773a /test-suite/tests/web-http.test
parentd975a8dec6b2517dc180f60e01f37fc9bd1aaa07 (diff)
downloadguile-0bcf5d78ecb40871fb48cf0f1a6065be38a3a14b.tar.gz
web: Gracefully handle premature EOF when reading chunk header.
* module/web/http.scm (read-chunk-header): Return 0 when 'read-line' returns EOF.
Diffstat (limited to 'test-suite/tests/web-http.test')
-rw-r--r--test-suite/tests/web-http.test10
1 files changed, 10 insertions, 0 deletions
diff --git a/test-suite/tests/web-http.test b/test-suite/tests/web-http.test
index 8a7a29542..bd14de9b9 100644
--- a/test-suite/tests/web-http.test
+++ b/test-suite/tests/web-http.test
@@ -423,6 +423,16 @@
(utf8->string (get-bytevector-n port 6))
(reverse requests)))))
+ (pass-if-equal "EOF instead of chunk header"
+ "Only chunk."
+ ;; Omit the second chunk header, leading to a premature EOF. This
+ ;; used to cause 'read-chunk-header' to throw to wrong-type-arg.
+ ;; See the backtrace at
+ ;; <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19976#5>.
+ (let* ((str "B\r\nOnly chunk.")
+ (port (make-chunked-input-port (open-input-string str))))
+ (get-string-all port)))
+
(pass-if-equal
(call-with-output-string
(lambda (out-raw)