From 8cccdc7db69d7ad3bc3c40991358997903b5d396 Mon Sep 17 00:00:00 2001 From: Zhao Yongming Date: Sat, 2 Jul 2016 19:09:08 +0800 Subject: [PATCH] TS-4396: fix number_of_redirections off-by-one --- proxy/http/HttpSM.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 9016c4b40cf..b2da8bdcfec 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -1954,9 +1954,7 @@ HttpSM::state_read_server_response_header(int event, void *data) t_state.api_next_action = HttpTransact::SM_ACTION_API_READ_RESPONSE_HDR; // if exceeded limit deallocate postdata buffers and disable redirection - if (enable_redirection && (redirection_tries < t_state.txn_conf->number_of_redirections)) { - ++redirection_tries; - } else { + if (enable_redirection && (redirection_tries >= t_state.txn_conf->number_of_redirections)) { tunnel.deallocate_redirect_postdata_buffers(); enable_redirection = false; } @@ -7710,6 +7708,7 @@ HttpSM::redirect_request(const char *redirect_url, const int redirect_len) } t_state.redirect_info.redirect_in_process = true; + redirection_tries++; // set the passed in location url and parse it URL &redirectUrl = t_state.redirect_info.redirect_url;