You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sh...@apache.org on 2019/02/14 17:34:12 UTC

[trafficserver] branch master updated: Remove unnecessary storing of redirect_url in redirect_info

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 707ccf3  Remove unnecessary storing of redirect_url in redirect_info
707ccf3 is described below

commit 707ccf346c3e97d5b0b37fe5250f1cef839f5e5d
Author: Susan Hinrichs <sh...@oath.com>
AuthorDate: Mon Feb 11 15:45:30 2019 +0000

    Remove unnecessary storing of redirect_url in redirect_info
---
 proxy/http/HttpSM.cc       | 11 ++++-------
 proxy/http/HttpTransact.cc |  8 +-------
 proxy/http/HttpTransact.h  |  2 --
 3 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 462febb..4450247 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -7727,13 +7727,8 @@ HttpSM::redirect_request(const char *arg_redirect_url, const int arg_redirect_le
   t_state.redirect_info.redirect_in_process = true;
 
   // set the passed in location url and parse it
-  URL &redirectUrl = t_state.redirect_info.redirect_url;
-  if (!redirectUrl.valid()) {
-    redirectUrl.create(nullptr);
-  }
-
-  // reset the path from previous redirects (if any)
-  t_state.redirect_info.redirect_url.path_set(nullptr, 0);
+  URL redirectUrl;
+  redirectUrl.create(nullptr);
 
   redirectUrl.parse(arg_redirect_url, arg_redirect_len);
   {
@@ -7763,6 +7758,8 @@ HttpSM::redirect_request(const char *arg_redirect_url, const int arg_redirect_le
   // copy the redirect url to the client url
   clientUrl.copy(&redirectUrl);
 
+  redirectUrl.destroy();
+
   //(bug 2540703) Clear the previous response if we will attempt the redirect
   if (t_state.hdr_info.client_response.valid()) {
     // XXX - doing a destroy() for now, we can do a fileds_clear() if we have performance issue
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 604db29..a85263d 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -7551,13 +7551,7 @@ HttpTransact::build_request(State *s, HTTPHdr *base_request, HTTPHdr *outgoing_r
   //
   // notice that currently, based_request IS client_request
   if (base_request == &s->hdr_info.client_request) {
-    if (s->redirect_info.redirect_in_process) {
-      // this is for auto redirect
-      URL *r_url = &s->redirect_info.redirect_url;
-
-      ink_assert(r_url->valid());
-      base_request->url_set(r_url);
-    } else {
+    if (!s->redirect_info.redirect_in_process) {
       // this is for multiple cache lookup
       URL *o_url = &s->cache_info.original_url;
 
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index d76f0ec..5315cdb 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -530,7 +530,6 @@ public:
   typedef struct _RedirectInfo {
     bool redirect_in_process = false;
     URL original_url;
-    URL redirect_url;
 
     _RedirectInfo() {}
   } RedirectInfo;
@@ -882,7 +881,6 @@ public:
       cache_info.object_store.destroy();
       cache_info.transform_store.destroy();
       redirect_info.original_url.destroy();
-      redirect_info.redirect_url.destroy();
 
       url_map.clear();
       arena.reset();