This is an automated email from the ASF dual-hosted git repository.
zwoop 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 a6c14f0 Move where the HttpSM setup for redirect before going to
origin
a6c14f0 is described below
commit a6c14f0ddf72dfcb5b51cc08df5aa8afe5730df0
Author: Leif Hedstrom <[email protected]>
AuthorDate: Tue May 30 17:12:56 2017 -0600
Move where the HttpSM setup for redirect before going to origin
This allows plugins like conf_remap.so to set these settings:
@pparam=proxy.config.http.number_of_redirections=3 \
@pparam=proxy.config.http.redirect_use_orig_cache_key=1
(as an example). Before this, you would need to set the enabled flag before
remap (in read-request-header hook). With this change, we can modify the
overridable configuratios in e.g. conf_remap, or any other remap plugin.
In addition, this removes proxy.config.http.redirection_enabled, and
instead setting proxy.config.http.number_of_redirections to 0 (default)
disables this feature.
This is an incompatible change, and should be properly documented.
---
doc/admin-guide/files/records.config.en.rst | 10 +----
.../plugins/collapsed_forwarding.en.rst | 1 -
doc/admin-guide/plugins/ts_lua.en.rst | 1 -
.../api/functions/TSHttpOverridableConfig.en.rst | 1 -
.../api/types/TSOverridableConfigKey.en.rst | 1 -
.../api/functions/TSHttpOverridableConfig.en.po | 5 ---
lib/perl/lib/Apache/TS/AdminClient.pm | 1 -
lib/ts/apidefs.h.in | 1 -
mgmt/RecordsConfig.cc | 11 ++----
plugins/experimental/collapsed_forwarding/README | 1 -
.../collapsed_forwarding/collapsed_forwarding.cc | 1 -
plugins/experimental/ts_lua/ts_lua_http_config.c | 2 -
proxy/InkAPI.cc | 43 +++++-----------------
proxy/InkAPITest.cc | 1 -
proxy/api/ts/ts.h | 2 -
proxy/http/HttpConfig.cc | 21 ++---------
proxy/http/HttpConfig.h | 16 ++------
proxy/http/HttpSM.cc | 6 ---
proxy/http/HttpTransact.cc | 11 ++++++
19 files changed, 32 insertions(+), 104 deletions(-)
diff --git a/doc/admin-guide/files/records.config.en.rst
b/doc/admin-guide/files/records.config.en.rst
index c5801c6..f5e43d8 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -1442,15 +1442,7 @@ HTTP Connection Timeouts
HTTP Redirection
================
-.. ts:cv:: CONFIG proxy.config.http.redirection_enabled INT 0
- :reloadable:
- :overridable:
-
- This setting indicates whether Trafficserver does a redirect follow
location on receiving a 3XX Redirect response from the Origin
- server. The redirection attempt is transparent to the client and the client
is served the final response from the redirected-to
- location.
-
-.. ts:cv:: CONFIG proxy.config.http.number_of_redirections INT 1
+.. ts:cv:: CONFIG proxy.config.http.number_of_redirections INT 0
:reloadable:
:overridable:
diff --git a/doc/admin-guide/plugins/collapsed_forwarding.en.rst
b/doc/admin-guide/plugins/collapsed_forwarding.en.rst
index ab84577..f479da3 100644
--- a/doc/admin-guide/plugins/collapsed_forwarding.en.rst
+++ b/doc/admin-guide/plugins/collapsed_forwarding.en.rst
@@ -83,7 +83,6 @@ plugin to work::
:ts:cv:`proxy.config.http.cache.open_write_fail_action` 1
:ts:cv:`proxy.config.cache.enable_read_while_writer` 1
-:ts:cv:`proxy.config.http.redirection_enabled` 1
:ts:cv:`proxy.config.http.number_of_redirections` 10
:ts:cv:`proxy.config.http.redirect_use_orig_cache_key` 1
:ts:cv:`proxy.config.http.background_fill_active_timeout` 0
diff --git a/doc/admin-guide/plugins/ts_lua.en.rst
b/doc/admin-guide/plugins/ts_lua.en.rst
index 7575359..caf715e 100644
--- a/doc/admin-guide/plugins/ts_lua.en.rst
+++ b/doc/admin-guide/plugins/ts_lua.en.rst
@@ -3127,7 +3127,6 @@ Http config constants
TS_LUA_CONFIG_HTTP_CACHE_GENERATION
TS_LUA_CONFIG_BODY_FACTORY_TEMPLATE_BASE
TS_LUA_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION
- TS_LUA_CONFIG_HTTP_ENABLE_REDIRECTION
TS_LUA_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS
TS_LUA_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRIES
TS_LUA_CONFIG_LAST_ENTRY
diff --git a/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
b/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
index 0f9e0a8..dbf7161 100644
--- a/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
+++ b/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
@@ -113,7 +113,6 @@ c:member:`TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK`
:ts:cv:`prox
c:member:`TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS`
:ts:cv:`proxy.config.http.doc_in_cache_skip_dns`
c:member:`TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD`
:ts:cv:`proxy.config.http.down_server.abort_threshold`
c:member:`TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME`
:ts:cv:`proxy.config.http.down_server.cache_time`
-c:member:`TS_CONFIG_HTTP_ENABLE_REDIRECTION`
:ts:cv:`proxy.config.http.redirection_enabled`
c:member:`TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED`
:ts:cv:`proxy.config.http.flow_control.enabled`
c:member:`TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK`
:ts:cv:`proxy.config.http.flow_control.high_water`
c:member:`TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK`
:ts:cv:`proxy.config.http.flow_control.low_water`
diff --git a/doc/developer-guide/api/types/TSOverridableConfigKey.en.rst
b/doc/developer-guide/api/types/TSOverridableConfigKey.en.rst
index cba9f59..3cd4a89 100644
--- a/doc/developer-guide/api/types/TSOverridableConfigKey.en.rst
+++ b/doc/developer-guide/api/types/TSOverridableConfigKey.en.rst
@@ -80,7 +80,6 @@ Enumeration Members
.. c:member:: TSOverridableConfigKey TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS
.. c:member:: TSOverridableConfigKey
TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD
.. c:member:: TSOverridableConfigKey TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME
-.. c:member:: TSOverridableConfigKey TS_CONFIG_HTTP_ENABLE_REDIRECTION
.. c:member:: TSOverridableConfigKey TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED
.. c:member:: TSOverridableConfigKey
TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK
.. c:member:: TSOverridableConfigKey
TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK
diff --git
a/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSHttpOverridableConfig.en.po
b/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSHttpOverridableConfig.en.po
index 35c6fb7..da245f1 100644
---
a/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSHttpOverridableConfig.en.po
+++
b/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSHttpOverridableConfig.en.po
@@ -425,11 +425,6 @@ msgstr
":ts:cv:`proxy.config.http.cache.when_to_revalidate`"
msgid ":ts:cv:`proxy.config.http.cache.open_write_fail_action`"
msgstr ":ts:cv:`proxy.config.http.cache.when_to_revalidate`"
-#: ../../../developer-guide/api/functions/TSHttpOverridableConfig.en.rst:150
-#, fuzzy
-msgid ":ts:cv:`proxy.config.http.redirection_enabled`"
-msgstr ":ts:cv:`proxy.config.http.flow_control.enabled`"
-
#: ../../../developer-guide/api/functions/TSHttpOverridableConfig.en.rst:151
#, fuzzy
msgid ":ts:cv:`proxy.config.http.number_of_redirections`"
diff --git a/lib/perl/lib/Apache/TS/AdminClient.pm
b/lib/perl/lib/Apache/TS/AdminClient.pm
index 42b3128..762e4af 100644
--- a/lib/perl/lib/Apache/TS/AdminClient.pm
+++ b/lib/perl/lib/Apache/TS/AdminClient.pm
@@ -512,7 +512,6 @@ The Apache Traffic Server Administration Manual will
explain what these strings
proxy.config.http.push_method_enabled
proxy.config.http.quick_filter.mask
proxy.config.http.record_heartbeat
- proxy.config.http.redirection_enabled
proxy.config.http.referer_default_redirect
proxy.config.http.referer_filter
proxy.config.http.referer_format_redirect
diff --git a/lib/ts/apidefs.h.in b/lib/ts/apidefs.h.in
index 6e2888e..9c3dd1c 100644
--- a/lib/ts/apidefs.h.in
+++ b/lib/ts/apidefs.h.in
@@ -733,7 +733,6 @@ typedef enum {
TS_CONFIG_HTTP_CACHE_GENERATION,
TS_CONFIG_BODY_FACTORY_TEMPLATE_BASE,
TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION,
- TS_CONFIG_HTTP_ENABLE_REDIRECTION,
TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS,
TS_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRIES,
TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY,
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index f7d331a..8a711f8 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -171,15 +171,12 @@ static const RecordElement RecordsConfig[] =
//#
//# Redirection
//#
- //# 1. redirection_enabled: if set to 1, redirection is enabled.
- //# 2. number_of_redirectionse: The maximum number of redirections TS permits
- //# 3. proxy.config.http.redirect_use_orig_cache_key: Location Header if set
to 0 (default), else use original request cache key
- //# 4. post_copy_size: The maximum POST data size TS permits to copy
+ //# 1. number_of_redirections: The maximum number of redirections TS
permits. Disabled if set to 0 (default)
+ //# 2. proxy.config.http.redirect_use_orig_cache_key: Location Header if set
to 0 (default), else use original request cache key
+ //# 3. post_copy_size: The maximum POST data size TS permits to copy
//#
//##############################################################################
- {RECT_CONFIG, "proxy.config.http.redirection_enabled", RECD_INT, "0",
RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
- ,
- {RECT_CONFIG, "proxy.config.http.number_of_redirections", RECD_INT, "1",
RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
+ {RECT_CONFIG, "proxy.config.http.number_of_redirections", RECD_INT, "0",
RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
{RECT_CONFIG, "proxy.config.http.redirect_use_orig_cache_key", RECD_INT,
"0", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL}
,
diff --git a/plugins/experimental/collapsed_forwarding/README
b/plugins/experimental/collapsed_forwarding/README
index 6cdd5c5..49ee7f8 100644
--- a/plugins/experimental/collapsed_forwarding/README
+++ b/plugins/experimental/collapsed_forwarding/README
@@ -12,7 +12,6 @@
////////////////////////////////////////////////////////////////////////////////////
// proxy.config.http.cache.open_write_fail_action 1
/////////////////////////
// proxy.config.cache.enable_read_while_writer 1
/////////////////////////
-// proxy.config.http.redirection_enabled 1
/////////////////////////
// proxy.config.http.number_of_redirections 10
/////////////////////////
// proxy.config.http.redirect_use_orig_cache_key 1
/////////////////////////
// proxy.config.http.background_fill_active_timeout 0
/////////////////////////
diff --git a/plugins/experimental/collapsed_forwarding/collapsed_forwarding.cc
b/plugins/experimental/collapsed_forwarding/collapsed_forwarding.cc
index b631020..9e4d41e 100644
--- a/plugins/experimental/collapsed_forwarding/collapsed_forwarding.cc
+++ b/plugins/experimental/collapsed_forwarding/collapsed_forwarding.cc
@@ -33,7 +33,6 @@
////////////////////////////////////////////////////////////////////////////////////
// proxy.config.http.cache.open_write_fail_action 1
/////////////////////////
// proxy.config.cache.enable_read_while_writer 1
/////////////////////////
-// proxy.config.http.redirection_enabled 1
/////////////////////////
// proxy.config.http.number_of_redirections 10
/////////////////////////
// proxy.config.http.redirect_use_orig_cache_key 1
/////////////////////////
// proxy.config.http.background_fill_active_timeout 0
/////////////////////////
diff --git a/plugins/experimental/ts_lua/ts_lua_http_config.c
b/plugins/experimental/ts_lua/ts_lua_http_config.c
index 36d0dcd..d33d4ed 100644
--- a/plugins/experimental/ts_lua/ts_lua_http_config.c
+++ b/plugins/experimental/ts_lua/ts_lua_http_config.c
@@ -103,7 +103,6 @@ typedef enum {
TS_LUA_CONFIG_HTTP_CACHE_GENERATION =
TS_CONFIG_HTTP_CACHE_GENERATION,
TS_LUA_CONFIG_BODY_FACTORY_TEMPLATE_BASE =
TS_CONFIG_BODY_FACTORY_TEMPLATE_BASE,
TS_LUA_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION =
TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION,
- TS_LUA_CONFIG_HTTP_ENABLE_REDIRECTION =
TS_CONFIG_HTTP_ENABLE_REDIRECTION,
TS_LUA_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS =
TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS,
TS_LUA_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRIES =
TS_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRIES,
TS_LUA_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY =
TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY,
@@ -225,7 +224,6 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_GENERATION),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_BODY_FACTORY_TEMPLATE_BASE),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION),
- TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_ENABLE_REDIRECTION),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRIES),
TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY),
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 6822592..c3f40fe 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7394,7 +7394,7 @@ TSCacheHttpInfoSizeSet(TSCacheHttpInfo infop, int64_t
size)
// This API tells the core to follow normal (301/302) redirects using the
// standard Location: URL. This does not need to be called if you set an
-// explicit URL using TSRedirectUrlSet().
+// explicit URL using TSHttpTxnRedirectUrlSet().
TSReturnCode
TSHttpTxnFollowRedirect(TSHttpTxn txnp, int on)
{
@@ -7403,6 +7403,11 @@ TSHttpTxnFollowRedirect(TSHttpTxn txnp, int on)
HttpSM *sm = (HttpSM *)txnp;
sm->enable_redirection = (on ? true : false);
+ // Make sure we allow for at least one redirection.
+ if (0 == sm->redirection_tries) {
+ sm->redirection_tries = 1;
+ }
+
return TS_SUCCESS;
}
@@ -7424,32 +7429,10 @@ TSHttpTxnRedirectUrlSet(TSHttpTxn txnp, const char
*url, const int url_len)
sm->redirect_url = (char *)url;
sm->redirect_url_len = url_len;
sm->enable_redirection = true;
-}
-
-// Deprecated, remove for v6.0.0
-void
-TSRedirectUrlSet(TSHttpTxn txnp, const char *url, const int url_len)
-{
- sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
- sdk_assert(sdk_sanity_check_null_ptr((void *)url) == TS_SUCCESS);
-
- HttpSM *sm = (HttpSM *)txnp;
- if (sm->redirect_url != nullptr) {
- ats_free(sm->redirect_url);
- sm->redirect_url = nullptr;
- sm->redirect_url_len = 0;
- }
-
- sm->redirect_url = (char *)ats_malloc(url_len + 1);
- ink_strlcpy(sm->redirect_url, url, url_len + 1);
- sm->redirect_url_len = url_len;
- // have to turn redirection on for this transaction if user wants to
redirect to another URL
- if (sm->enable_redirection == false) {
- sm->enable_redirection = true;
- // max-out "redirection_tries" to avoid the regular redirection being
turned on in
- // this transaction improperly. This variable doesn't affect the
custom-redirection
- sm->redirection_tries = sm->t_state.txn_conf->number_of_redirections;
+ // Make sure we allow for at least one redirection.
+ if (0 == sm->redirection_tries) {
+ sm->redirection_tries = 1;
}
}
@@ -8038,9 +8021,6 @@ _conf_to_memberp(TSOverridableConfigKey conf,
OverridableHttpConfigParams *overr
case TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION:
ret =
_memberp_to_generic(&overridableHttpConfig->cache_open_write_fail_action,
typep);
break;
- case TS_CONFIG_HTTP_ENABLE_REDIRECTION:
- ret = _memberp_to_generic(&overridableHttpConfig->redirection_enabled,
typep);
- break;
case TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS:
ret = _memberp_to_generic(&overridableHttpConfig->number_of_redirections,
typep);
break;
@@ -8409,11 +8389,6 @@ TSHttpTxnConfigFind(const char *name, int length,
TSOverridableConfigKey *conf,
case 37:
switch (name[length - 1]) {
- case 'd':
- if (!strncmp(name, "proxy.config.http.redirection_enabled", length)) {
- cnf = TS_CONFIG_HTTP_ENABLE_REDIRECTION;
- }
- break;
case 'e':
if (!strncmp(name, "proxy.config.http.cache.max_stale_age", length)) {
cnf = TS_CONFIG_HTTP_CACHE_MAX_STALE_AGE;
diff --git a/proxy/InkAPITest.cc b/proxy/InkAPITest.cc
index 8d5d20f..12b3720 100644
--- a/proxy/InkAPITest.cc
+++ b/proxy/InkAPITest.cc
@@ -7583,7 +7583,6 @@ const char *SDK_Overridable_Configs[TS_CONFIG_LAST_ENTRY]
= {
"proxy.config.http.cache.generation",
"proxy.config.body_factory.template_base",
"proxy.config.http.cache.open_write_fail_action",
- "proxy.config.http.redirection_enabled",
"proxy.config.http.number_of_redirections",
"proxy.config.http.cache.max_open_write_retries",
"proxy.config.http.redirect_use_orig_cache_key",
diff --git a/proxy/api/ts/ts.h b/proxy/api/ts/ts.h
index ed7863e..8027b06 100644
--- a/proxy/api/ts/ts.h
+++ b/proxy/api/ts/ts.h
@@ -2299,8 +2299,6 @@ tsapi TSReturnCode TSHttpTxnFollowRedirect(TSHttpTxn
txnp, int on);
@param url_len the length of the URL
*/
tsapi void TSHttpTxnRedirectUrlSet(TSHttpTxn txnp, const char *url, const int
url_len);
-// This is deprecated as of v5.0.0.
-tsapi TS_DEPRECATED void TSRedirectUrlSet(TSHttpTxn txnp, const char *url,
const int url_len);
/**
Return the current (if set) redirection URL string. This is still owned by
the
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index dfe6d53..e6eb67a 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1223,14 +1223,12 @@ HttpConfig::startup()
//#
//# Redirection
//#
- //# 1. redirection_enabled: if set to 1, redirection is enabled.
+ //# 1. number_of_redirections: The maximum number of redirections YTS
permits. 0 == disabled
//# 2. redirect_use_orig_cache_key: if set to 1, use original request cache
key.
- //# 3. number_of_redirections: The maximum number of redirections YTS permits
- //# 4. post_copy_size: The maximum POST data size YTS permits to copy
- //# 5. redirection_host_no_port: do not include default port in host header
during redirection
+ //# 3. post_copy_size: The maximum POST data size YTS permits to copy
+ //# 4. redirection_host_no_port: do not include default port in host header
during redirection
//#
//##############################################################################
- HttpEstablishStaticConfigByte(c.oride.redirection_enabled,
"proxy.config.http.redirection_enabled");
HttpEstablishStaticConfigByte(c.oride.redirect_use_orig_cache_key,
"proxy.config.http.redirect_use_orig_cache_key");
HttpEstablishStaticConfigByte(c.redirection_host_no_port,
"proxy.config.http.redirect_host_no_port");
HttpEstablishStaticConfigLongLong(c.oride.number_of_redirections,
"proxy.config.http.number_of_redirections");
@@ -1493,19 +1491,6 @@ HttpConfig::reconfigure()
params->oride.negative_revalidating_enabled =
INT_TO_BOOL(m_master.oride.negative_revalidating_enabled);
params->oride.negative_revalidating_lifetime =
m_master.oride.negative_revalidating_lifetime;
-
//##############################################################################
- //#
- //# Redirection
- //#
- //# 1. redirection_enabled: if set to 1, redirection is enabled.
- //# 2. redirect_use_orig_cache_key: if set to 1, use original request cache
key.
- //# 3. number_of_redirections: The maximum number of redirections YTS permits
- //# 4. post_copy_size: The maximum POST data size YTS permits to copy
- //# 5. redirection_host_no_port: do not include default port in host header
during redirection
- //#
-
//##############################################################################
-
- params->oride.redirection_enabled =
INT_TO_BOOL(m_master.oride.redirection_enabled);
params->oride.redirect_use_orig_cache_key =
INT_TO_BOOL(m_master.oride.redirect_use_orig_cache_key);
params->redirection_host_no_port =
INT_TO_BOOL(m_master.redirection_host_no_port);
params->oride.number_of_redirections =
m_master.oride.number_of_redirections;
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index b52f831..80a67d3 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -416,9 +416,8 @@ struct OverridableHttpConfigParams {
cache_open_write_fail_action(0),
post_check_content_length_enabled(1),
ssl_client_verify_server(0),
- redirection_enabled(0),
redirect_use_orig_cache_key(0),
- number_of_redirections(1),
+ number_of_redirections(0),
proxy_response_hsts_max_age(-1),
negative_caching_lifetime(1800),
negative_revalidating_lifetime(1800),
@@ -587,16 +586,9 @@ struct OverridableHttpConfigParams {
/////////////////////////////
MgmtByte ssl_client_verify_server;
-
//##############################################################################
- //#
- //# Redirection
- //#
- //# 1. redirection_enabled: if set to 1, redirection is enabled.
- //# 2. number_of_redirectionse: The maximum number of redirections YTS
permits
- //# 3. post_copy_size: The maximum POST data size YTS permits to copy
- //#
-
//##############################################################################
- MgmtByte redirection_enabled;
+ //////////////////
+ // Redirection //
+ //////////////////
MgmtByte redirect_use_orig_cache_key;
MgmtInt number_of_redirections;
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index b9ca8cd..b321fb8 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -734,12 +734,6 @@ HttpSM::state_read_client_request_header(int event, void
*data)
// another IO later for the body with a different buffer
ua_entry->read_vio->nbytes = ua_entry->read_vio->ndone;
}
- // YTS Team, yamsat Plugin
- // Setting enable_redirection according to HttpConfig master
- if ((t_state.txn_conf->number_of_redirections > 0) ||
- (t_state.method == HTTP_WKSIDX_POST &&
HttpConfig::m_master.post_copy_size)) {
- enable_redirection = t_state.txn_conf->redirection_enabled;
- }
call_transact_and_set_next_state(HttpTransact::ModifyRequest);
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 395b6f0..03b698a 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -669,6 +669,11 @@ HttpTransact::StartRemapRequest(State *s)
s->hdr_info.client_request.set_url_target_from_host_field();
+ // Since we're not doing remap, we still have to allow for these
overridable
+ // configurations to modify follow-redirect behavior. Someone could for
example
+ // have set them in a plugin other than conf_remap running in a prior hook.
+ s->state_machine->enable_redirection =
(s->txn_conf->number_of_redirections > 0);
+
if (s->is_upgrade_request && s->post_remap_upgrade_return_point) {
TRANSACT_RETURN(SM_ACTION_POST_REMAP_SKIP,
s->post_remap_upgrade_return_point);
}
@@ -751,6 +756,12 @@ HttpTransact::EndRemapRequest(State *s)
const char *host = incoming_request->host_get(&host_len);
DebugTxn("http_trans", "EndRemapRequest host is %.*s", host_len, host);
+ // Setting enable_redirection according to HttpConfig (master or
overridable). We
+ // defer this as late as possible, to allow plugins to modify the overridable
+ // configurations (e.g. conf_remap.so). We intentionally only modify this if
+ // the configuration says so.
+ s->state_machine->enable_redirection = (s->txn_conf->number_of_redirections
> 0);
+
////////////////////////////////////////////////////////////////
// if we got back a URL to redirect to, vector the user there //
////////////////////////////////////////////////////////////////
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].