@@ -2271,6 +2271,7 @@ H1_CLIENT_TEST_CASE(h1_client_response_get_headers) {
22712271 & tester .testing_channel ,
22722272 "HTTP/1.1 308 Permanent Redirect\r\n"
22732273 "Date: Fri, 01 Mar 2019 17:18:55 GMT\r\n"
2274+ "Content-Length: 0\r\n"
22742275 "Location: /index.html\r\n"
22752276 "\r\n" ));
22762277
@@ -2722,7 +2723,8 @@ H1_CLIENT_TEST_CASE(h1_client_response_arrives_before_request_done_sending_is_ok
27222723 aws_input_stream_release (body_stream );
27232724
27242725 /* send response */
2725- ASSERT_SUCCESS (testing_channel_push_read_str (& tester .testing_channel , "HTTP/1.1 200 OK\r\n\r\n" ));
2726+ ASSERT_SUCCESS (
2727+ testing_channel_push_read_str (& tester .testing_channel , "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" ));
27262728
27272729 /* tick loop until body finishes sending.*/
27282730 while (body_sender .cursor .len > 0 ) {
@@ -2745,7 +2747,7 @@ H1_CLIENT_TEST_CASE(h1_client_response_arrives_before_request_done_sending_is_ok
27452747 ASSERT_TRUE (stream_tester .complete );
27462748 ASSERT_INT_EQUALS (AWS_ERROR_SUCCESS , stream_tester .on_complete_error_code );
27472749 ASSERT_INT_EQUALS (200 , stream_tester .response_status );
2748- ASSERT_UINT_EQUALS (0 , aws_http_headers_count (stream_tester .response_headers ));
2750+ ASSERT_UINT_EQUALS (1 , aws_http_headers_count (stream_tester .response_headers ));
27492751 ASSERT_UINT_EQUALS (0 , stream_tester .response_body .len );
27502752
27512753 /* clean up */
@@ -2788,7 +2790,8 @@ H1_CLIENT_TEST_CASE(h1_client_response_arrives_before_request_chunks_done_sendin
27882790 testing_channel_run_currently_queued_tasks (& tester .testing_channel );
27892791
27902792 /* send response */
2791- ASSERT_SUCCESS (testing_channel_push_read_str (& tester .testing_channel , "HTTP/1.1 200 OK\r\n\r\n" ));
2793+ ASSERT_SUCCESS (
2794+ testing_channel_push_read_str (& tester .testing_channel , "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" ));
27922795
27932796 testing_channel_run_currently_queued_tasks (& tester .testing_channel );
27942797
@@ -2826,7 +2829,7 @@ H1_CLIENT_TEST_CASE(h1_client_response_arrives_before_request_chunks_done_sendin
28262829 ASSERT_TRUE (stream_tester .complete );
28272830 ASSERT_INT_EQUALS (AWS_ERROR_SUCCESS , stream_tester .on_complete_error_code );
28282831 ASSERT_INT_EQUALS (200 , stream_tester .response_status );
2829- ASSERT_UINT_EQUALS (0 , aws_http_headers_count (stream_tester .response_headers ));
2832+ ASSERT_UINT_EQUALS (1 , aws_http_headers_count (stream_tester .response_headers ));
28302833 ASSERT_UINT_EQUALS (0 , stream_tester .response_body .len );
28312834
28322835 /* clean up */
@@ -2841,7 +2844,8 @@ H1_CLIENT_TEST_CASE(h1_client_response_without_request_shuts_down_connection) {
28412844 struct tester tester ;
28422845 ASSERT_SUCCESS (s_tester_init (& tester , allocator ));
28432846
2844- ASSERT_SUCCESS (testing_channel_push_read_str_ignore_errors (& tester .testing_channel , "HTTP/1.1 200 OK\r\n\r\n" ));
2847+ ASSERT_SUCCESS (testing_channel_push_read_str_ignore_errors (
2848+ & tester .testing_channel , "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" ));
28452849 testing_channel_drain_queued_tasks (& tester .testing_channel );
28462850
28472851 ASSERT_TRUE (testing_channel_is_shutdown_completed (& tester .testing_channel ));
@@ -2874,6 +2878,7 @@ H1_CLIENT_TEST_CASE(h1_client_response_close_header_ends_connection) {
28742878 ASSERT_SUCCESS (testing_channel_push_read_str (
28752879 & tester .testing_channel ,
28762880 "HTTP/1.1 200 OK\r\n"
2881+ "Content-Length: 0\r\n"
28772882 "Connection: close\r\n"
28782883 "\r\n" ));
28792884
@@ -2938,6 +2943,7 @@ H1_CLIENT_TEST_CASE(h1_client_request_close_header_ends_connection) {
29382943 ASSERT_SUCCESS (testing_channel_push_read_str (
29392944 & tester .testing_channel ,
29402945 "HTTP/1.1 200 OK\r\n"
2946+ "Content-Length: 0\r\n"
29412947 "\r\n" ));
29422948
29432949 testing_channel_drain_queued_tasks (& tester .testing_channel );
@@ -2983,9 +2989,11 @@ H1_CLIENT_TEST_CASE(h1_client_response_close_header_with_pipelining) {
29832989 & tester .testing_channel ,
29842990 /* Response 1 */
29852991 "HTTP/1.1 200 OK\r\n"
2992+ "Content-Length: 0\r\n"
29862993 "\r\n"
29872994 /* Response 2 */
29882995 "HTTP/1.1 200 OK\r\n"
2996+ "Content-Length: 0\r\n"
29892997 "Connection: close\r\n"
29902998 "\r\n" ));
29912999
@@ -3069,9 +3077,11 @@ H1_CLIENT_TEST_CASE(h1_client_request_close_header_with_pipelining) {
30693077 & tester .testing_channel ,
30703078 /* Response 1 */
30713079 "HTTP/1.1 200 OK\r\n"
3080+ "Content-Length: 0\r\n"
30723081 "\r\n"
30733082 /* Response 2 */
30743083 "HTTP/1.1 200 OK\r\n"
3084+ "Content-Length: 0\r\n"
30753085 "\r\n" ));
30763086
30773087 testing_channel_drain_queued_tasks (& tester .testing_channel );
@@ -3175,9 +3185,11 @@ H1_CLIENT_TEST_CASE(h1_client_request_close_header_with_chunked_encoding_and_pip
31753185 & tester .testing_channel ,
31763186 /* Response 1 */
31773187 "HTTP/1.1 200 OK\r\n"
3188+ "Content-Length: 0\r\n"
31783189 "\r\n"
31793190 /* Response 2 */
31803191 "HTTP/1.1 200 OK\r\n"
3192+ "Content-Length: 0\r\n"
31813193 "\r\n" ));
31823194
31833195 testing_channel_drain_queued_tasks (& tester .testing_channel );
@@ -4786,6 +4798,7 @@ H1_CLIENT_TEST_CASE(h1_client_response_close_connection_before_request_finishes)
47864798 & tester .testing_channel ,
47874799 "HTTP/1.1 404 Not Found\r\n"
47884800 "Date: Fri, 01 Mar 2019 17:18:55 GMT\r\n"
4801+ "Content-Length: 0\r\n"
47894802 "Connection: close\r\n"
47904803 "\r\n" ));
47914804
0 commit comments