Skip to content

Commit a78369c

Browse files
committed
fix docs
1 parent b265ed4 commit a78369c

3 files changed

Lines changed: 20 additions & 10 deletions

File tree

bin/elasticurl/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct elasticurl_ctx {
6666
bool exchange_completed;
6767
bool manual_write;
6868
bool manual_write_chunked;
69-
int64_t manual_write_content_length;
69+
uint32_t manual_write_content_length;
7070
struct aws_http_stream *stream;
7171
bool stream_ready;
7272
};
@@ -717,8 +717,9 @@ int main(int argc, char **argv) {
717717

718718
/* Interactive prompt for manual-write mode */
719719
if (app_ctx.manual_write) {
720-
if (!strcmp(app_ctx.verb, "GET")) {
721-
app_ctx.verb = "POST";
720+
if (!strcmp(app_ctx.verb, "POST")) {
721+
fprintf(stderr, "Only POST requests allowed for manual_writes. Exiting... \n");
722+
return 1;
722723
}
723724
fprintf(stderr, "Manual write mode enabled.\n");
724725
fprintf(stderr, "Content-Length (leave empty for chunked transfer encoding): ");

include/aws/http/request_response.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,16 +303,26 @@ struct aws_http_make_request_options {
303303
/**
304304
* When true, request body data will be provided over time via `aws_http_stream_write_data()`.
305305
* The stream will only be polled for writing when data has been supplied.
306-
* Works with both HTTP/1.1 (Content-Length) and HTTP/2.
307306
* When false (default), the entire request body is read from the input stream immediately.
307+
*
308+
* HTTP/1.1 requirements:
309+
* - SHOULD have either `Content-Length` OR `Transfer-Encoding: chunked` header (but not both).
310+
* Transfer-Encoding header will be automatically added Content-Length is absent.
311+
* - MUST NOT have a body stream set. Fails with AWS_ERROR_HTTP_INVALID_HEADER_FIELD otherwise.
312+
* - With `Content-Length`: total bytes written must exactly match the declared length.
313+
* Fails with AWS_ERROR_HTTP_OUTGOING_STREAM_LENGTH_INCORRECT if data exceeds Content-Length,
314+
* or if `end_stream` is set before enough data is written.
315+
* - With `Transfer-Encoding: chunked`: no length validation, data sent as chunks.
316+
*
317+
* HTTP/2: No `Content-Length` or `Transfer-Encoding` header required. Data sent via DATA frames.
308318
*/
309319
bool use_manual_data_writes;
310320

311321
/**
322+
* This field will be DEPRECATED and removed in a future release.
323+
* Use `use_manual_data_writes` instead, which works for both HTTP/1.1 and HTTP/2.
312324
* When using HTTP/2, request body data will be provided over time. The stream will only be polled for writing
313325
* when data has been supplied via `aws_http2_stream_write_data`.
314-
* Use `use_manual_data_writes` instead, which works for both HTTP/1.1 and HTTP/2.
315-
* This field will be deprecated and removed in a future release.
316326
*/
317327
bool http2_use_manual_data_writes;
318328

@@ -509,7 +519,7 @@ typedef aws_http_stream_write_complete_fn aws_http2_stream_write_data_complete_f
509519

510520
/**
511521
* Unified options for writing data to an HTTP stream.
512-
* Works with both HTTP/1.1 (with Content-Length) and HTTP/2.
522+
* Works with both HTTP/1.1 and HTTP/2.
513523
*/
514524
struct aws_http_stream_write_data_options {
515525
AWS_HTTP_STREAM_WRITE_DATA_OPTIONS_FIELDS
@@ -929,8 +939,8 @@ AWS_HTTP_API int aws_http1_stream_write_chunk(
929939
* Works with both HTTP/1.1 and HTTP/2.
930940
*
931941
* The stream must have specified `use_manual_data_writes` during request creation.
932-
* 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 either a Content-Length header or Transfer-Encoding: chunked header,
942+
* For HTTP/1.1: The request must have either a Content-Length header or/and Transfer-Encoding: chunked header,
943+
* (if Content-Length is not set, Transfer-Encoding: chunked is automatically added)
934944
* and must NOT have a body stream set.
935945
*
936946
* For client streams, activate() must be called before any data is written.

source/h1_stream.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,6 @@ struct aws_h1_stream *aws_h1_stream_new_request(
582582

583583
/* Set manual data writes flag from options */
584584
stream->synced_data.using_manual_data_writes = options->use_manual_data_writes;
585-
stream->thread_data.using_manual_data_writes = options->use_manual_data_writes;
586585

587586
/* Validate request and cache info that the encoder will eventually need */
588587
if (aws_h1_encoder_message_init_from_request(

0 commit comments

Comments
 (0)