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 Jun 2, 2021
1 parent 9d6cd86 commit 366cfba
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 @@ -945,19 +945,20 @@ let test_shutdown_during_asynchronous_request () =

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 366cfba

Please sign in to comment.