Skip to content

Commit 1f7c463

Browse files
committed
address some comments
1 parent af32dd9 commit 1f7c463

7 files changed

Lines changed: 124 additions & 669 deletions

File tree

examples/curl_content_length_example.c

Lines changed: 0 additions & 267 deletions
This file was deleted.

include/aws/http/private/h1_stream.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ struct aws_h1_stream {
8787
/* Whether a "request handler" stream has a response to send.
8888
* Has mirror variable in synced_data */
8989
bool has_outgoing_response : 1;
90-
91-
/* Total bytes written so far for Content-Length validation */
92-
uint64_t incremental_content_written;
9390
} thread_data;
9491

9592
/* Any thread may touch this data, but the connection's lock must be held.

include/aws/http/request_response.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,11 +926,12 @@ AWS_HTTP_API int aws_http1_stream_write_chunk(
926926

927927
/**
928928
* Write data to an HTTP stream in a protocol-agnostic way.
929-
* Works with both HTTP/1.1 (with Content-Length) and HTTP/2.
929+
* Works with both HTTP/1.1 and HTTP/2.
930930
*
931931
* The stream must have specified `use_manual_data_writes` during request creation.
932932
* Note: `http2_use_manual_data_writes` also works for HTTP/2 but should be deprecated in favor of this unified flag.
933-
* For HTTP/1.1: The request must have a Content-Length header and must NOT have a body stream set.
933+
* For HTTP/1.1: The request must have either a Content-Length header or Transfer-Encoding: chunked header,
934+
* and must NOT have a body stream set.
934935
*
935936
* For client streams, activate() must be called before any data is written.
936937
* For server streams, the response must be submitted before any data is written.

source/h1_stream.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ static int s_stream_write_data(
438438
}
439439

440440
if (is_chunked) {
441-
/* Convert write_data into chunk(s) for chunked encoding */
441+
/* Convert write_data into a chunk for chunked encoding */
442442
int64_t data_len = 0;
443443
if (aws_input_stream_get_length(options->data, &data_len)) {
444444
AWS_LOGF_ERROR(
@@ -454,21 +454,7 @@ static int s_stream_write_data(
454454
.on_complete = options->on_complete,
455455
.user_data = options->user_data,
456456
};
457-
if (aws_http1_stream_write_chunk(stream_base, &chunk_opts)) {
458-
return AWS_OP_ERR;
459-
}
460-
461-
/* If end_stream, also submit terminating zero-length chunk */
462-
if (options->end_stream) {
463-
struct aws_http1_chunk_options terminator = {
464-
.chunk_data_size = 0,
465-
};
466-
if (aws_http1_stream_write_chunk(stream_base, &terminator)) {
467-
return AWS_OP_ERR;
468-
}
469-
}
470-
471-
return AWS_OP_SUCCESS;
457+
return aws_http1_stream_write_chunk(stream_base, &chunk_opts);
472458
}
473459

474460
/* Content-Length path: create data write and push to pending list */

tests/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,10 @@ add_test_case(h1_client_connection_close_before_request_finishes_with_buffer_for
159159
add_test_case(h1_client_connection_close_before_request_finishes_with_buffer_stream_cancel)
160160
add_test_case(h1_client_write_data_single_chunk)
161161
add_test_case(h1_client_write_data_multiple_chunks)
162-
add_test_case(h1_client_write_data_not_enabled_with_body)
163-
add_test_case(h1_client_write_data_not_enabled_no_body)
162+
add_test_case(h1_client_write_data_not_enabled)
164163
add_test_case(h1_client_write_data_after_final)
165164
add_test_case(h1_client_write_data_exceeds_content_length)
166165
add_test_case(h1_client_write_data_less_than_content_length)
167-
add_test_case(h1_client_unified_write_data_api)
168166
add_test_case(h1_client_write_data_chunked_single)
169167
add_test_case(h1_client_write_data_chunked_multiple)
170168

@@ -525,7 +523,6 @@ add_test_case(h2_client_batch_auto_window_update)
525523
add_test_case(h2_client_batch_manual_window_update)
526524
add_test_case(h2_client_cap_manual_window_update)
527525
add_test_case(h2_client_unified_write_data_api)
528-
add_test_case(h2_client_backward_compat_write_data)
529526

530527
add_test_case(server_new_destroy)
531528
add_test_case(server_new_destroy_tcp)

0 commit comments

Comments
 (0)