trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shinr...@apache.org
Subject [trafficserver] branch master updated: Adjust follow redirect logic to address a crash and avoid arguments shadowing member variables.
Date Fri, 01 Feb 2019 16:02:58 GMT
This is an automated email from the ASF dual-hosted git repository.

shinrich 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 25e91b4  Adjust follow redirect logic to address a crash and avoid arguments shadowing
member variables.
25e91b4 is described below

commit 25e91b43ca8533d5a75805f2bb27939bb2d7a789
Author: Susan Hinrichs <shinrich@oath.com>
AuthorDate: Thu Jan 31 20:03:37 2019 +0000

    Adjust follow redirect logic to address a crash and avoid arguments shadowing member variables.
---
 proxy/http/HttpSM.cc       | 14 +++++++-------
 proxy/http/HttpTransact.cc |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 5cb5da1..57caf2b 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -7703,7 +7703,7 @@ HttpSM::do_redirect()
 }
 
 void
-HttpSM::redirect_request(const char *redirect_url, const int redirect_len)
+HttpSM::redirect_request(const char *arg_redirect_url, const int arg_redirect_len)
 {
   SMDebug("http_redirect", "[HttpSM::redirect_request]");
   // get a reference to the client request header and client url and check to see if the
url is valid
@@ -7754,22 +7754,22 @@ HttpSM::redirect_request(const char *redirect_url, const int redirect_len)
   // reset the path from previous redirects (if any)
   t_state.redirect_info.redirect_url.path_set(nullptr, 0);
 
-  // redirectUrl.user_set(redirect_url, redirect_len);
-  redirectUrl.parse(redirect_url, redirect_len);
+  redirectUrl.parse(arg_redirect_url, arg_redirect_len);
   {
     int _scheme_len = -1;
     int _host_len   = -1;
-    if (redirectUrl.scheme_get(&_scheme_len) == nullptr && redirectUrl.host_get(&_host_len)
!= nullptr && redirect_url[0] != '/') {
+    if (redirectUrl.scheme_get(&_scheme_len) == nullptr && redirectUrl.host_get(&_host_len)
!= nullptr &&
+        arg_redirect_url[0] != '/') {
       // RFC7230 ยง 5.5
       // The redirect URL lacked a scheme and so it is a relative URL.
       // The redirect URL did not begin with a slash, so we parsed some or all
       // of the the relative URI path as the host.
       // Prepend a slash and parse again.
-      char redirect_url_leading_slash[redirect_len + 1];
+      char redirect_url_leading_slash[arg_redirect_len + 1];
       redirect_url_leading_slash[0] = '/';
-      memcpy(redirect_url_leading_slash + 1, redirect_url, redirect_len + 1);
+      memcpy(redirect_url_leading_slash + 1, arg_redirect_url, arg_redirect_len + 1);
       url_nuke_proxy_stuff(redirectUrl.m_url_impl);
-      redirectUrl.parse(redirect_url_leading_slash, redirect_len + 1);
+      redirectUrl.parse(redirect_url_leading_slash, arg_redirect_len + 1);
     }
   }
 
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 68ff019..272c339 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7556,7 +7556,7 @@ HttpTransact::build_request(State *s, HTTPHdr *base_request, HTTPHdr
*outgoing_r
       URL *r_url = &s->redirect_info.redirect_url;
 
       ink_assert(r_url->valid());
-      base_request->url_get()->copy(r_url);
+      base_request->url_set(r_url);
     } else {
       // this is for multiple cache lookup
       URL *o_url = &s->cache_info.original_url;


Mime
View raw message