From 366cfbadd40af2e0dbe14432314995a5b3de406b Mon Sep 17 00:00:00 2001 From: Doug Patti Date: Sat, 22 May 2021 18:30:35 -0400 Subject: [PATCH] demonstrate broken chunked behavior --- lib_test/test_server_connection.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_test/test_server_connection.ml b/lib_test/test_server_connection.ml index 5f1b6f9b..86474879 100644 --- a/lib_test/test_server_connection.ml +++ b/lib_test/test_server_connection.ml @@ -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 ;;