about summary refs log tree commit homepage
path: root/ext
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-04-26 15:02:46 -0700
committerEric Wong <normalperson@yhbt.net>2010-04-26 15:08:10 -0700
commitc54df54f6633f3467b64fdfc9cbff278d02397ac (patch)
tree86481f48c3f247446fe9b1ef8f1b592ba1a0728f /ext
parentde0e3a2f969730f4682daf6cff1e0d424ddd43e1 (diff)
downloadunicorn-c54df54f6633f3467b64fdfc9cbff278d02397ac.tar.gz
HTTP requests without trailers still need a CRLF after the last
chunk, that is: it must end as: "0\r\n\r\n", not "0\r\n".  So
we'll always pretend there are trailers to parse for the
sake of TeeInput.

This is mostly a pedantic fix, as the two bytes in the socket
buffer are unlikely to trigger protocol errors.
Diffstat (limited to 'ext')
-rw-r--r--ext/unicorn_http/unicorn_http.rl8
1 files changed, 2 insertions, 6 deletions
diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl
index f0b602b..264db68 100644
--- a/ext/unicorn_http/unicorn_http.rl
+++ b/ext/unicorn_http/unicorn_http.rl
@@ -299,12 +299,8 @@ static void write_value(VALUE req, struct http_parser *hp,
   }
 
   action end_chunked_body {
-    if (HP_FL_TEST(hp, HASTRAILER)) {
-      HP_FL_SET(hp, INTRAILER);
-      cs = http_parser_en_Trailers;
-    } else {
-      cs = http_parser_first_final;
-    }
+    HP_FL_SET(hp, INTRAILER);
+    cs = http_parser_en_Trailers;
     ++p;
     assert(p <= pe && "buffer overflow after chunked body");
     goto post_exec;