You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2018/02/07 01:08:31 UTC
[trafficserver] branch master updated: Fixes the escalate plugin
such that redirects are followed
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 b2344ed Fixes the escalate plugin such that redirects are followed
b2344ed is described below
commit b2344edfc463d62933d6c6fc3372c45e3159562a
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Mon Feb 5 20:10:07 2018 -0700
Fixes the escalate plugin such that redirects are followed
Or any other plugin using the TSHttpTxnRedirectUrlSet().
This closes #2924
---
proxy/InkAPI.cc | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index e28d76f..a077b21 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -7482,6 +7482,9 @@ 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 TSHttpTxnRedirectUrlSet().
+//
+// TODO: This should be deprecated on 7.1.x, and removed from 8.0.0, now that the configuration
+// for this is properly overridable.
TSReturnCode
TSHttpTxnFollowRedirect(TSHttpTxn txnp, int on)
{
@@ -7489,10 +7492,19 @@ 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;
+ // This is necessary since we might not have setup these overridable configurations
+ sm->t_state.setup_per_txn_configs();
+
+ if (on) {
+ sm->redirection_tries = 0;
+ sm->enable_redirection = true;
+ // Make sure we allow for at least one redirection.
+ if (sm->t_state.txn_conf->number_of_redirections <= 0) {
+ sm->t_state.txn_conf->number_of_redirections = 1;
+ }
+ } else {
+ sm->enable_redirection = false;
+ sm->t_state.txn_conf->number_of_redirections = 0;
}
return TS_SUCCESS;
@@ -7516,10 +7528,12 @@ 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;
+ sm->redirection_tries = 0;
// Make sure we allow for at least one redirection.
- if (0 == sm->redirection_tries) {
- sm->redirection_tries = 1;
+ if (sm->t_state.txn_conf->number_of_redirections <= 0) {
+ sm->t_state.setup_per_txn_configs();
+ sm->t_state.txn_conf->number_of_redirections = 1;
}
}
--
To stop receiving notification emails like this one, please contact
zwoop@apache.org.