about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-04-20 22:52:37 +0000
committerEric Wong <e@80x24.org>2018-12-01 13:26:44 +0000
commite2973f39f372235c2ae377d85a1c5a3c4582e967 (patch)
treefd5c12173750b48ef9313d0a9ac03b9c6d73a17c
parent15c9b06ade212176a1b7c84faf34328a9be12711 (diff)
downloadkcar-e2973f39f372235c2ae377d85a1c5a3c4582e967.tar.gz
Negative len.content is used to denote chunked responses
on #body_bytes_left, but we don't use that for request
parsing.
-rw-r--r--ext/kcar/kcar.rl2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/kcar/kcar.rl b/ext/kcar/kcar.rl
index c85eb3c..336af55 100644
--- a/ext/kcar/kcar.rl
+++ b/ext/kcar/kcar.rl
@@ -199,6 +199,8 @@ static void finalize_header(struct http_parser *hp, VALUE hdr)
         rb_raise(eParserError, "Content-Length set with chunked encoding");
       else
         hp->len.chunk = 0;
+    } else if (hp->len.content < 0) {
+        hp->len.content = 0;
     }
 
     if (!hp->has_query)