You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2018/05/10 12:59:13 UTC
[trafficserver] branch master updated: Adding
proxy.config.http.allow_half_open
This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 3164c00 Adding proxy.config.http.allow_half_open
3164c00 is described below
commit 3164c00c64bec5b0f20c09958e24cba42eba8577
Author: Zizhong Zhang <zi...@linkedin.com>
AuthorDate: Wed Mar 21 20:26:20 2018 -0700
Adding proxy.config.http.allow_half_open
---
doc/admin-guide/files/records.config.en.rst | 7 +++++++
doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst | 1 +
lib/ts/apidefs.h.in | 1 +
mgmt/RecordsConfig.cc | 2 ++
plugins/experimental/ts_lua/ts_lua_http_config.c | 2 ++
proxy/InkAPI.cc | 5 +++++
proxy/InkAPITest.cc | 3 ++-
proxy/http/Http1ClientTransaction.cc | 6 ++++++
proxy/http/Http1ClientTransaction.h | 6 +-----
proxy/http/HttpConfig.cc | 4 ++++
proxy/http/HttpConfig.h | 6 ++++++
11 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index f301370..1ae25da 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -3812,6 +3812,13 @@ Sockets
exception being if you run Traffic Server with a protocol plugin, and would
like for it to not support HTTP requests at all.
+.. ts:cv:: CONFIG proxy.config.http.allow_half_open INT 1
+ :reloadable:
+ :overridable:
+
+ Turn on or off support for connection half open for client side. Default is on, so
+ after client sends FIN, the connection is still there.
+
.. ts:cv:: CONFIG proxy.config.http.wait_for_cache INT 0
Accepting inbound connections and starting the cache are independent
diff --git a/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst b/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
index 17e2a61..aa352b4 100644
--- a/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
+++ b/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
@@ -170,6 +170,7 @@ TSOverridableConfigKey Value Configuratio
:c:macro:`TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT` :ts:cv:`proxy.config.http.parent_proxy.connect_attempts_timeout`
: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`
================================================================== ====================================================================
Examples
diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
index a228d68..b59c168 100644
--- a/lib/ts/apidefs.h.in
+++ b/lib/ts/apidefs.h.in
@@ -769,6 +769,7 @@ typedef enum {
TS_CONFIG_HTTP_INSERT_FORWARDED,
TS_CONFIG_HTTP_ALLOW_MULTI_RANGE,
TS_CONFIG_HTTP_REQUEST_BUFFER_ENABLED,
+ TS_CONFIG_HTTP_ALLOW_HALF_OPEN,
TS_CONFIG_LAST_ENTRY
} TSOverridableConfigKey;
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 21559c5..c5d1fe3 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -305,6 +305,8 @@ static const RecordElement RecordsConfig[] =
// # basics #
// ##########
// #
+ {RECT_CONFIG, "proxy.config.http.allow_half_open", RECD_INT, "1", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+ ,
{RECT_CONFIG, "proxy.config.http.enabled", RECD_INT, "1", RECU_RESTART_TM, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.server_ports", RECD_STRING, "8080 8080:ipv6", RECU_RESTART_TM, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
diff --git a/plugins/experimental/ts_lua/ts_lua_http_config.c b/plugins/experimental/ts_lua/ts_lua_http_config.c
index a81eae2..6110f76 100644
--- a/plugins/experimental/ts_lua/ts_lua_http_config.c
+++ b/plugins/experimental/ts_lua/ts_lua_http_config.c
@@ -134,6 +134,7 @@ typedef enum {
TS_LUA_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT = TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT,
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,
TS_LUA_CONFIG_LAST_ENTRY = TS_CONFIG_LAST_ENTRY,
} TSLuaOverridableConfigKey;
@@ -260,6 +261,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT),
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),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY),
};
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 565f839..d40522d 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -8262,6 +8262,9 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr
case TS_CONFIG_HTTP_ALLOW_MULTI_RANGE:
ret = _memberp_to_generic(&overridableHttpConfig->allow_multi_range, typep);
break;
+ case TS_CONFIG_HTTP_ALLOW_HALF_OPEN:
+ ret = _memberp_to_generic(&overridableHttpConfig->allow_half_open, typep);
+ break;
// This helps avoiding compiler warnings, yet detect unhandled enum members.
case TS_CONFIG_NULL:
case TS_CONFIG_LAST_ENTRY:
@@ -8510,6 +8513,8 @@ TSHttpTxnConfigFind(const char *name, int length, TSOverridableConfigKey *conf,
if (!strncmp(name, "proxy.config.ssl.client.cert.path", length)) {
cnf = TS_CONFIG_SSL_CERT_FILEPATH;
typ = TS_RECORDDATATYPE_STRING;
+ } else if (!strncmp(name, "proxy.config.http.allow_half_open", length)) {
+ cnf = TS_CONFIG_HTTP_ALLOW_HALF_OPEN;
}
break;
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 2b8c2f1..af5b5f3 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7607,7 +7607,8 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY] = {"proxy.config.url_r
"proxy.config.http.normalize_ae",
"proxy.config.http.insert_forwarded",
"proxy.config.http.allow_multi_range",
- "proxy.config.http.request_buffer_enabled"};
+ "proxy.config.http.request_buffer_enabled",
+ "proxy.config.http.allow_half_open"};
REGRESSION_TEST(SDK_API_OVERRIDABLE_CONFIGS)(RegressionTest *test, int /* atype ATS_UNUSED */, int *pstatus)
{
diff --git a/proxy/http/Http1ClientTransaction.cc b/proxy/http/Http1ClientTransaction.cc
index 54d5fc2..2d4edb0 100644
--- a/proxy/http/Http1ClientTransaction.cc
+++ b/proxy/http/Http1ClientTransaction.cc
@@ -67,3 +67,9 @@ Http1ClientTransaction::transaction_done()
static_cast<Http1ClientSession *>(parent)->release_transaction();
}
}
+
+bool
+Http1ClientTransaction::allow_half_open() const
+{
+ return current_reader ? current_reader->t_state.txn_conf->allow_half_open > 0 : true;
+}
diff --git a/proxy/http/Http1ClientTransaction.h b/proxy/http/Http1ClientTransaction.h
index 312ea0f..0251b2c 100644
--- a/proxy/http/Http1ClientTransaction.h
+++ b/proxy/http/Http1ClientTransaction.h
@@ -87,11 +87,7 @@ public:
return false;
}
- bool
- allow_half_open() const override
- {
- return true;
- }
+ bool allow_half_open() const override;
void set_parent(ProxyClientSession *new_parent) override;
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index db9b443..0660f7d 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1067,6 +1067,8 @@ HttpConfig::startup()
HttpEstablishStaticConfigLongLong(c.oride.cache_max_stale_age, "proxy.config.http.cache.max_stale_age");
HttpEstablishStaticConfigByte(c.oride.srv_enabled, "proxy.config.srv_enabled");
+ HttpEstablishStaticConfigByte(c.oride.allow_half_open, "proxy.config.http.allow_half_open");
+
HttpEstablishStaticConfigStringAlloc(c.oride.cache_vary_default_text, "proxy.config.http.cache.vary_default_text");
HttpEstablishStaticConfigStringAlloc(c.oride.cache_vary_default_images, "proxy.config.http.cache.vary_default_images");
HttpEstablishStaticConfigStringAlloc(c.oride.cache_vary_default_other, "proxy.config.http.cache.vary_default_other");
@@ -1348,6 +1350,8 @@ HttpConfig::reconfigure()
params->oride.srv_enabled = m_master.oride.srv_enabled;
+ params->oride.allow_half_open = m_master.oride.allow_half_open;
+
// open read failure retries
params->oride.max_cache_open_read_retries = m_master.oride.max_cache_open_read_retries;
params->oride.cache_open_read_retry_time = m_master.oride.cache_open_read_retry_time;
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 2f156ff..f0acf74 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -450,6 +450,7 @@ struct OverridableHttpConfigParams {
cache_open_write_fail_action(0),
post_check_content_length_enabled(1),
request_buffer_enabled(0),
+ allow_half_open(1),
ssl_client_verify_server(0),
redirect_use_orig_cache_key(0),
number_of_redirections(0),
@@ -629,6 +630,11 @@ struct OverridableHttpConfigParams {
////////////////////////////////////////////////
MgmtByte request_buffer_enabled;
+ /////////////////////////////////////////////////
+ // Keep connection open after client sends FIN //
+ /////////////////////////////////////////////////
+ MgmtByte allow_half_open;
+
/////////////////////////////
// server verification mode//
/////////////////////////////
--
To stop receiving notification emails like this one, please contact
bcall@apache.org.