Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions configs/records.config.default.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ CONFIG proxy.config.http.insert_response_via_str INT 0
CONFIG proxy.config.http.parent_proxy_routing_enable INT 0
CONFIG proxy.config.http.parent_proxy.retry_time INT 300
CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout INT 30
CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout INT 0
CONFIG proxy.config.http.forward.proxy_auth_to_parent INT 0
CONFIG proxy.config.http.uncacheable_requests_bypass_parent INT 1

Expand All @@ -62,6 +63,8 @@ CONFIG proxy.config.http.connect_attempts_max_retries_dead_server INT 1
CONFIG proxy.config.http.connect_attempts_rr_retries INT 3
CONFIG proxy.config.http.connect_attempts_timeout INT 30
CONFIG proxy.config.http.post_connect_attempts_timeout INT 1800
CONFIG proxy.config.http.connect_attempts_timeout_ms INT 0
CONFIG proxy.config.http.post_connect_attempts_timeout_ms INT 0
CONFIG proxy.config.http.down_server.cache_time INT 60
CONFIG proxy.config.http.down_server.abort_threshold INT 10

Expand Down
26 changes: 26 additions & 0 deletions doc/admin-guide/files/records.config.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,14 @@ Parent Proxy Configuration

See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts.

.. ts:cv:: CONFIG proxy.config.http.parent_proxy.connect_attempts_timeout_ms INT 0
:reloadable:
:overridable:

The timeout value (in milliseconds) for parent cache connection attempts. If set this will override the usage of proxy.config.http.parent_proxy.connect_attempts_timeout.

See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts.

.. ts:cv:: CONFIG proxy.config.http.parent_proxy.mark_down_hostdb INT 0
:reloadable:
:overridable:
Expand Down Expand Up @@ -1445,6 +1453,15 @@ Origin Server Connect Attempts

See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts.

.. ts:cv:: CONFIG proxy.config.http.connect_attempts_timeout_ms INT 0
:reloadable:
:overridable:

The timeout value (in milliseconds) for time to first byte for an origin server
connection. If set this will override the usage of proxy.config.http.connect_attempts_timeout.

See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts.

.. ts:cv:: CONFIG proxy.config.http.post_connect_attempts_timeout INT 1800
:reloadable:
:overridable:
Expand All @@ -1454,6 +1471,15 @@ Origin Server Connect Attempts

See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts.

.. ts:cv:: CONFIG proxy.config.http.post_connect_attempts_timeout_ms INT 0
:reloadable:
:overridable:

The timeout value (in milliseconds) for an origin server connection when the client request is a ``POST`` or ``PUT``
request. If set this will override the usage of proxy.config.http.post_connect_attempts_timeout.

See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts.

.. ts:cv:: CONFIG proxy.config.http.post.check.content_length.enabled INT 1

Enables (``1``) or disables (``0``) checking the Content-Length: Header for a POST request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ TSOverridableConfigKey Value Configuratio
:c:macro:`TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DEAD_SERVER` :ts:cv:`proxy.config.http.connect_attempts_max_retries_dead_server`
:c:macro:`TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES` :ts:cv:`proxy.config.http.connect_attempts_rr_retries`
:c:macro:`TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT` :ts:cv:`proxy.config.http.connect_attempts_timeout`
:c:macro:`TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS` :ts:cv:`proxy.config.http.connect_attempts_timeout_ms`
:c:macro:`TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE` :ts:cv:`proxy.config.http.default_buffer_size`
:c:macro:`TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK` :ts:cv:`proxy.config.http.default_buffer_water_mark`
:c:macro:`TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS` :ts:cv:`proxy.config.http.doc_in_cache_skip_dns`
Expand Down Expand Up @@ -135,6 +136,7 @@ TSOverridableConfigKey Value Configuratio
:c:macro:`TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB` :ts:cv:`proxy.config.http.parent_proxy.mark_down_hostdb`
:c:macro:`TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED` :ts:cv:`proxy.config.http.post.check.content_length.enabled`
:c:macro:`TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT` :ts:cv:`proxy.config.http.post_connect_attempts_timeout`
:c:macro:`TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS` :ts:cv:`proxy.config.http.post_connect_attempts_timeout_ms`
:c:macro:`TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY` :ts:cv:`proxy.config.http.redirect_use_orig_cache_key`
:c:macro:`TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE` :ts:cv:`proxy.config.http.request_header_max_size`
:c:macro:`TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE` :ts:cv:`proxy.config.http.response_header_max_size`
Expand Down Expand Up @@ -165,7 +167,7 @@ TSOverridableConfigKey Value Configuratio
:c:macro:`TS_CONFIG_HTTP_PARENT_PROXY_FAIL_THRESHOLD` :ts:cv:`proxy.config.http.parent_proxy.fail_threshold`
:c:macro:`TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME` :ts:cv:`proxy.config.http.parent_proxy.retry_time`
:c:macro:`TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS` :ts:cv:`proxy.config.http.parent_proxy.per_parent_connect_attempts`
:c:macro:`TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT` :ts:cv:`proxy.config.http.parent_proxy.connect_attempts_timeout`
:c:macro:`TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS` :ts:cv:`proxy.config.http.parent_proxy.connect_attempts_timeout_ms`
:c:macro:`TS_CONFIG_HTTP_NORMALIZE_AE` :ts:cv:`proxy.config.http.normalize_ae`
:c:macro:`TS_CONFIG_HTTP_ALLOW_MULTI_RANGE` :ts:cv:`proxy.config.http.allow_multi_range`
:c:macro:`TS_CONFIG_HTTP_ALLOW_HALF_OPEN` :ts:cv:`proxy.config.http.allow_half_open`
Expand Down
3 changes: 3 additions & 0 deletions lib/ts/apidefs.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,8 @@ typedef enum {
TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES,
TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT,
TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT,
TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS,
TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS,
TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME,
TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD,
TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS,
Expand Down Expand Up @@ -771,6 +773,7 @@ typedef enum {
TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME,
TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS,
TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT,
TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS,
TS_CONFIG_HTTP_NORMALIZE_AE,
TS_CONFIG_HTTP_INSERT_FORWARDED,
TS_CONFIG_HTTP_ALLOW_MULTI_RANGE,
Expand Down
6 changes: 6 additions & 0 deletions mgmt/RecordsConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ static const RecordElement RecordsConfig[] =
{RECT_CONFIG, "proxy.config.http.parent_proxy.per_parent_connect_attempts", RECD_INT, "2", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.parent_proxy.connect_attempts_timeout", RECD_INT, "30", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.parent_proxy.connect_attempts_timeout_ms", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.parent_proxy.mark_down_hostdb", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
,
Expand Down Expand Up @@ -490,6 +492,10 @@ static const RecordElement RecordsConfig[] =
,
{RECT_CONFIG, "proxy.config.http.post_connect_attempts_timeout", RECD_INT, "1800", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.connect_attempts_timeout_ms", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.post_connect_attempts_timeout_ms", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.down_server.cache_time", RECD_INT, "60", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.down_server.abort_threshold", RECD_INT, "10", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
Expand Down
6 changes: 6 additions & 0 deletions plugins/lua/ts_lua_http_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ typedef enum {
TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES,
TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT,
TS_LUA_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT = TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT,
TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS = TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS,
TS_LUA_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS = TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS,
TS_LUA_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME = TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME,
TS_LUA_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD = TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD,
TS_LUA_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS = TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS,
Expand Down Expand Up @@ -132,6 +134,7 @@ typedef enum {
TS_LUA_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME = TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME,
TS_LUA_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS = TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS,
TS_LUA_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT = TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT,
TS_LUA_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS = TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS,
TS_LUA_CONFIG_HTTP_ALLOW_MULTI_RANGE = TS_CONFIG_HTTP_ALLOW_MULTI_RANGE,
TS_LUA_CONFIG_HTTP_REQUEST_BUFFER_ENABLED = TS_CONFIG_HTTP_REQUEST_BUFFER_ENABLED,
TS_LUA_CONFIG_HTTP_ALLOW_HALF_OPEN = TS_CONFIG_HTTP_ALLOW_HALF_OPEN,
Expand Down Expand Up @@ -196,6 +199,8 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT_MS),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT_MS),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS),
Expand Down Expand Up @@ -257,6 +262,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT_MS),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_ALLOW_MULTI_RANGE),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_REQUEST_BUFFER_ENABLED),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_ALLOW_HALF_OPEN),
Expand Down
69 changes: 59 additions & 10 deletions proxy/http/HttpConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ RecRawStatBlock *http_rsb;
RecSetRawStatCount(http_rsb, x, 0); \
} while (0);

static bool
http_config_var_is_default(char const *name)
{
RecSourceT vs;
return REC_ERR_OKAY != RecGetRecordSource(name, &vs) || vs == REC_SOURCE_DEFAULT || vs == REC_SOURCE_NULL;
}

class HttpConfigCont : public Continuation
{
public:
Expand Down Expand Up @@ -206,6 +213,28 @@ http_insert_forwarded_cb(const char *name, RecDataT dtype, RecData data, void *c
return REC_ERR_OKAY;
}

static int
http_connect_attempt_timeout_cb(const char * name, RecDataT dtype, RecData data, void * cookie) {
bool update_p = false;
auto *c = static_cast<HttpConfigParams *>(cookie);

if (0 == strcasecmp(name, "proxy.config.http.parent_proxy.connect_attempts_timeout")) {
if (RECD_INT == dtype) {
c->oride.post_connect_attempts_timeout = HRTIME_SECONDS(data.rec_int);
update_p = true;
}
} else if (0 == strcasecmp(name, "proxy.config.http.parent_proxy.connect_attempts_timeout_ms")) {
if (RECD_INT == dtype) {
c->oride.post_connect_attempts_timeout = HRTIME_MSECONDS(data.rec_int);
update_p = true;
}
}
if (update_p) {
http_config_cb(name, dtype, data, cookie);
}
return REC_ERR_OKAY;
}

void
register_stat_callbacks()
{
Expand Down Expand Up @@ -958,6 +987,8 @@ load_negative_caching_var(RecRecord const *r, void *cookie)
void
HttpConfig::startup()
{
RecInt n; // temporary for loading special cases.

http_rsb = RecAllocateRawStatBlock((int)http_stat_count);
register_stat_callbacks();

Expand Down Expand Up @@ -1065,14 +1096,30 @@ HttpConfig::startup()
"proxy.config.http.connect_attempts_max_retries_dead_server");

HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_rr_retries, "proxy.config.http.connect_attempts_rr_retries");
HttpEstablishStaticConfigLongLong(c.oride.connect_attempts_timeout, "proxy.config.http.connect_attempts_timeout");

RecRegisterConfigUpdateCb("proxy.config.http.connect_attempts_timeout", &http_connect_attempt_timeout_cb, &c);
RecRegisterConfigUpdateCb("proxy.config.http.connect_attempts_timeout_ms", &http_connect_attempt_timeout_cb, &c);
// Do initial load - use ms if set, otherwise use base if set, otherwise just leave it default.
if (!http_config_var_is_default("proxy.config.connect_attempts_timeout_ms")) {
if (REC_ERR_OKAY == RecGetRecordInt("proxy.config.connect_attempts_timeout_ms", &n)) {
c.oride.connect_attempts_timeout = HRTIME_MSECONDS(n);
}
} else if (!http_config_var_is_default("proxy.config.connect_attempts_timeout")) {
if (REC_ERR_OKAY == RecGetRecordInt("proxy.config.connect_attempts_timeout", &n)) {
c.oride.connect_attempts_timeout = HRTIME_SECONDS(n);
}
}

HttpEstablishStaticConfigLongLong(c.oride.post_connect_attempts_timeout, "proxy.config.http.post_connect_attempts_timeout");
HttpEstablishStaticConfigLongLong(c.oride.post_connect_attempts_timeout_ms, "proxy.config.http.post_connect_attempts_timeout_ms");
HttpEstablishStaticConfigLongLong(c.oride.parent_connect_attempts, "proxy.config.http.parent_proxy.total_connect_attempts");
HttpEstablishStaticConfigLongLong(c.oride.parent_retry_time, "proxy.config.http.parent_proxy.retry_time");
HttpEstablishStaticConfigLongLong(c.oride.parent_fail_threshold, "proxy.config.http.parent_proxy.fail_threshold");
HttpEstablishStaticConfigLongLong(c.oride.per_parent_connect_attempts,
"proxy.config.http.parent_proxy.per_parent_connect_attempts");
HttpEstablishStaticConfigLongLong(c.oride.parent_connect_timeout, "proxy.config.http.parent_proxy.connect_attempts_timeout");
HttpEstablishStaticConfigLongLong(c.oride.parent_connect_timeout_ms,
"proxy.config.http.parent_proxy.connect_attempts_timeout_ms");
HttpEstablishStaticConfigByte(c.oride.parent_failures_update_hostdb, "proxy.config.http.parent_proxy.mark_down_hostdb");

HttpEstablishStaticConfigLongLong(c.oride.sock_recv_buffer_size_out, "proxy.config.net.sock_recv_buffer_size_out");
Expand Down Expand Up @@ -1342,15 +1389,17 @@ HttpConfig::reconfigure()
"will never redispatch to another server",
m_master.oride.connect_attempts_rr_retries, params->oride.connect_attempts_max_retries);
}
params->oride.connect_attempts_rr_retries = m_master.oride.connect_attempts_rr_retries;
params->oride.connect_attempts_timeout = m_master.oride.connect_attempts_timeout;
params->oride.post_connect_attempts_timeout = m_master.oride.post_connect_attempts_timeout;
params->oride.parent_connect_attempts = m_master.oride.parent_connect_attempts;
params->oride.parent_retry_time = m_master.oride.parent_retry_time;
params->oride.parent_fail_threshold = m_master.oride.parent_fail_threshold;
params->oride.per_parent_connect_attempts = m_master.oride.per_parent_connect_attempts;
params->oride.parent_connect_timeout = m_master.oride.parent_connect_timeout;
params->oride.parent_failures_update_hostdb = m_master.oride.parent_failures_update_hostdb;
params->oride.connect_attempts_rr_retries = m_master.oride.connect_attempts_rr_retries;
params->oride.connect_attempts_timeout = m_master.oride.connect_attempts_timeout;
params->oride.post_connect_attempts_timeout = m_master.oride.post_connect_attempts_timeout;
params->oride.post_connect_attempts_timeout_ms = m_master.oride.post_connect_attempts_timeout_ms;
params->oride.parent_connect_attempts = m_master.oride.parent_connect_attempts;
params->oride.parent_retry_time = m_master.oride.parent_retry_time;
params->oride.parent_fail_threshold = m_master.oride.parent_fail_threshold;
params->oride.per_parent_connect_attempts = m_master.oride.per_parent_connect_attempts;
params->oride.parent_connect_timeout = m_master.oride.parent_connect_timeout;
params->oride.parent_connect_timeout_ms = m_master.oride.parent_connect_timeout_ms;
params->oride.parent_failures_update_hostdb = m_master.oride.parent_failures_update_hostdb;

params->oride.sock_recv_buffer_size_out = m_master.oride.sock_recv_buffer_size_out;
params->oride.sock_send_buffer_size_out = m_master.oride.sock_send_buffer_size_out;
Expand Down
4 changes: 4 additions & 0 deletions proxy/http/HttpConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,13 @@ struct OverridableHttpConfigParams {
connect_attempts_rr_retries(3),
connect_attempts_timeout(30),
post_connect_attempts_timeout(1800),
post_connect_attempts_timeout_ms(0),
parent_connect_attempts(4),
parent_retry_time(300),
parent_fail_threshold(10),
per_parent_connect_attempts(2),
parent_connect_timeout(30),
parent_connect_timeout_ms(0),
down_server_timeout(300),
client_abort_threshold(10),
max_cache_open_read_retries(-1),
Expand Down Expand Up @@ -705,6 +707,7 @@ struct OverridableHttpConfigParams {
MgmtInt connect_attempts_rr_retries;
MgmtInt connect_attempts_timeout;
MgmtInt post_connect_attempts_timeout;
MgmtInt post_connect_attempts_timeout_ms;

////////////////////////////////////
// parent proxy connect attempts //
Expand All @@ -714,6 +717,7 @@ struct OverridableHttpConfigParams {
MgmtInt parent_fail_threshold;
MgmtInt per_parent_connect_attempts;
MgmtInt parent_connect_timeout;
MgmtInt parent_connect_timeout_ms;

MgmtInt down_server_timeout;
MgmtInt client_abort_threshold;
Expand Down
23 changes: 19 additions & 4 deletions proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5925,19 +5925,34 @@ HttpSM::attach_server_session(HttpServerSession *s)
// we fail this server if it doesn't start sending the response
// header
MgmtInt connect_timeout;
RecSourceT source;

if (t_state.method == HTTP_WKSIDX_POST || t_state.method == HTTP_WKSIDX_PUT) {
connect_timeout = t_state.txn_conf->post_connect_attempts_timeout;
RecGetRecordSource("proxy.config.http.post_connect_attempts_timeout_ms", &source, true);

// timeout ms value set by plugin or config, use it
if ((source == REC_SOURCE_PLUGIN) || (source == REC_SOURCE_EXPLICIT)) {
connect_timeout = HRTIME_MSECONDS(t_state.txn_conf->post_connect_attempts_timeout_ms);
} else {
connect_timeout = HRTIME_SECONDS(t_state.txn_conf->post_connect_attempts_timeout);
}
} else if (t_state.current.server == &t_state.parent_info) {
connect_timeout = t_state.txn_conf->parent_connect_timeout;
RecGetRecordSource("proxy.config.http.parent_proxy.connect_attempts_timeout_ms", &source, true);

// timeout ms value set by plugin or config, use it
if ((source == REC_SOURCE_PLUGIN) || (source == REC_SOURCE_EXPLICIT)) {
connect_timeout = HRTIME_MSECONDS(t_state.txn_conf->parent_connect_timeout_ms);
} else {
connect_timeout = HRTIME_SECONDS(t_state.txn_conf->parent_connect_timeout);
}
} else {
connect_timeout = t_state.txn_conf->connect_attempts_timeout;
connect_timeout = HRTIME_MSECONDS(t_state.txn_conf->connect_attempts_timeout);
}

if (t_state.api_txn_connect_timeout_value != -1) {
server_session->get_netvc()->set_inactivity_timeout(HRTIME_MSECONDS(t_state.api_txn_connect_timeout_value));
} else {
server_session->get_netvc()->set_inactivity_timeout(HRTIME_SECONDS(connect_timeout));
server_session->get_netvc()->set_inactivity_timeout(connect_timeout);
}

if (t_state.api_txn_active_timeout_value != -1) {
Expand Down
Loading