Skip to content

Commit 60c43f8

Browse files
authored
Supprt response_first_byte_timeout_ms in ConnectionManagerOptions (#505)
1 parent 23f62ee commit 60c43f8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/aws/http/connection_manager.h

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ struct aws_http_connection_manager_options {
5959
struct aws_client_bootstrap *bootstrap;
6060
size_t initial_window_size;
6161
const struct aws_socket_options *socket_options;
62+
/**
63+
* Optional (ignored if 0).
64+
* After a request is fully sent, if the server does not begin responding within N milliseconds,
65+
* then fail with AWS_ERROR_HTTP_RESPONSE_FIRST_BYTE_TIMEOUT.
66+
* This can be overridden per-request by aws_http_make_request_options.response_first_byte_timeout_ms.
67+
* TODO: Only supported in HTTP/1.1 now, support it in HTTP/2
68+
*/
69+
uint64_t response_first_byte_timeout_ms;
6270

6371
/**
6472
* Options to create secure (HTTPS) connections.

source/connection_manager.c

+4
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ struct aws_http_connection_manager {
240240
struct proxy_env_var_settings proxy_ev_settings;
241241
struct aws_tls_connection_options *proxy_ev_tls_options;
242242
uint32_t port;
243+
uint64_t response_first_byte_timeout_ms;
244+
243245
/*
244246
* HTTP/2 specific.
245247
*/
@@ -958,6 +960,7 @@ struct aws_http_connection_manager *aws_http_connection_manager_new(
958960
manager->max_connection_idle_in_milliseconds = options->max_connection_idle_in_milliseconds;
959961
manager->connection_acquisition_timeout_ms = options->connection_acquisition_timeout_ms;
960962
manager->max_pending_connection_acquisitions = options->max_pending_connection_acquisitions;
963+
manager->response_first_byte_timeout_ms = options->response_first_byte_timeout_ms;
961964

962965
if (options->proxy_ev_settings) {
963966
manager->proxy_ev_settings = *options->proxy_ev_settings;
@@ -1090,6 +1093,7 @@ static int s_aws_http_connection_manager_new_connection(struct aws_http_connecti
10901093
options.host_name = aws_byte_cursor_from_string(manager->host);
10911094
options.port = manager->port;
10921095
options.initial_window_size = manager->initial_window_size;
1096+
options.response_first_byte_timeout_ms = manager->response_first_byte_timeout_ms;
10931097
struct aws_socket_options socket_options = manager->socket_options;
10941098
if (aws_array_list_length(&manager->network_interface_names)) {
10951099
struct aws_string *interface_name = NULL;

0 commit comments

Comments
 (0)