File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -583,6 +583,23 @@ struct aws_h1_stream *aws_h1_stream_new_request(
583583 /* Set manual data writes flag from options */
584584 stream -> synced_data .using_manual_data_writes = options -> use_manual_data_writes ;
585585
586+ /* For manual data writes, add Transfer-Encoding: chunked if neither Content-Length nor Transfer-Encoding is set */
587+ if (options -> use_manual_data_writes ) {
588+ struct aws_http_headers * headers = aws_http_message_get_headers (options -> request );
589+ bool has_content_length =
590+ aws_http_headers_has (headers , aws_byte_cursor_from_c_str ("Content-Length" ));
591+ bool has_transfer_encoding =
592+ aws_http_headers_has (headers , aws_byte_cursor_from_c_str ("Transfer-Encoding" ));
593+ if (!has_content_length && !has_transfer_encoding ) {
594+ if (aws_http_headers_add (
595+ headers ,
596+ aws_byte_cursor_from_c_str ("Transfer-Encoding" ),
597+ aws_byte_cursor_from_c_str ("chunked" ))) {
598+ goto error ;
599+ }
600+ }
601+ }
602+
586603 /* Validate request and cache info that the encoder will eventually need */
587604 if (aws_h1_encoder_message_init_from_request (
588605 & stream -> thread_data .encoder_message ,
You can’t perform that action at this time.
0 commit comments