Skip to content

Commit

Permalink
demonstrate broken chunked behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
dpatti committed May 22, 2021
1 parent 55c100e commit dd4ff5d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib_test/test_server_connection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -927,19 +927,20 @@ let test_shutdown_in_request_handler () =

let test_flush_response_before_shutdown () =
let request = Request.create `GET "/" ~headers:(Headers.encoding_fixed 0) in
let response = Response.create `OK in
let response = Response.create `OK ~headers:Headers.encoding_chunked in
let continue = ref (fun () -> ()) in
let request_handler reqd =
let body = Reqd.respond_with_streaming ~flush_headers_immediately:true reqd response in
continue := (fun () ->
Body.write_string body "hello world");
Body.write_string body "hello world";
Body.close_writer body);
in
let t = create request_handler in
read_request t request;
write_response t response;
!continue ();
shutdown t;
write_string t "hello world";
write_string t "b\r\nhello world\r\n";
connection_is_shutdown t
;;

Expand Down

0 comments on commit dd4ff5d

Please sign in to comment.