diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-09-26 11:04:23 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-05-22 19:49:33 +0200 |
commit | 0bcf5d78ecb40871fb48cf0f1a6065be38a3a14b (patch) | |
tree | 5509f801ba9ed79eccc40cb7624b1581b633773a /test-suite/tests/web-http.test | |
parent | d975a8dec6b2517dc180f60e01f37fc9bd1aaa07 (diff) | |
download | guile-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.test | 10 |
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) |