Skip to content

Commit

Permalink
Merge pull request #223 from inhabitedtype/fix-zero-chunk-end-of-request
Browse files Browse the repository at this point in the history
fix-zero-chunk-end-of-request: finish after eol consumed
  • Loading branch information
seliopou authored Oct 27, 2022
2 parents eb2cb26 + e15e87d commit 9cefa96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/parse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ let body ~encoding body =
in
_hex >>= fun size ->
if size = 0L
then eol *> finish body
then eol >>= fun _eol -> finish body
else fixed size ~unexpected:"expected more from body chunk" *> eol *> p)
| `Close_delimited ->
fix (fun p ->
Expand Down
6 changes: 3 additions & 3 deletions lib_test/test_server_connection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ let test_echo_post () =
write_response t
~body:"e\r\nThis is a test\r\n"
response;
read_string t "\r\n0\r\n";
read_string t "\r\n0\r\n\r\n";
write_string t "0\r\n\r\n";
writer_yielded t;

Expand All @@ -427,7 +427,7 @@ let test_echo_post () =
response;
read_string t "\r\n21\r\n... that involves multiple chunks";
write_string t "21\r\n... that involves multiple chunks\r\n";
read_string t "\r\n0\r\n";
read_string t "\r\n0\r\n\r\n";
write_string t "0\r\n\r\n";
writer_yielded t;

Expand All @@ -442,7 +442,7 @@ let test_echo_post () =
~body:"This is a test"
response;
read_string t "\r\n21\r\n... that involves multiple chunks";
read_string t "\r\n0\r\n";
read_string t "\r\n0\r\n\r\n";
write_string t "... that involves multiple chunks";
connection_is_shutdown t;
;;
Expand Down

0 comments on commit 9cefa96

Please sign in to comment.