trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1232637 - in /trafficserver/traffic/trunk: ./ proxy/ proxy/http/ proxy/http/remap/ proxy/logging/
Date Tue, 17 Jan 2012 23:12:40 GMT
Author: zwoop
Date: Tue Jan 17 23:12:40 2012
New Revision: 1232637

URL: http://svn.apache.org/viewvc?rev=1232637&view=rev
Log:
TS-1081 eliminate an additional copy of the pristine URL string reference

Modified:
    trafficserver/traffic/trunk/CHANGES
    trafficserver/traffic/trunk/proxy/ReverseProxy.cc
    trafficserver/traffic/trunk/proxy/ReverseProxy.h
    trafficserver/traffic/trunk/proxy/http/HttpTransact.cc
    trafficserver/traffic/trunk/proxy/http/HttpTransact.h
    trafficserver/traffic/trunk/proxy/http/remap/RemapProcessor.cc
    trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.cc
    trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.h
    trafficserver/traffic/trunk/proxy/logging/LogAccessHttp.cc

Modified: trafficserver/traffic/trunk/CHANGES
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/CHANGES?rev=1232637&r1=1232636&r2=1232637&view=diff
==============================================================================
--- trafficserver/traffic/trunk/CHANGES (original)
+++ trafficserver/traffic/trunk/CHANGES Tue Jan 17 23:12:40 2012
@@ -1,5 +1,7 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.1.2
+  *) [TS-1081] Eliminate an additional copy of the pristine URL string.
+
   *) [TS-1038] SHttpTxnErrorBodySet() can leak memory.
    Author: Brian Geffon
 

Modified: trafficserver/traffic/trunk/proxy/ReverseProxy.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/ReverseProxy.cc?rev=1232637&r1=1232636&r2=1232637&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/ReverseProxy.cc (original)
+++ trafficserver/traffic/trunk/proxy/ReverseProxy.cc Tue Jan 17 23:12:40 2012
@@ -101,13 +101,11 @@ init_reverse_proxy()
 // odd ball configs, for example if you use the "CONNECT" method, or if you set
 // set proxy.config.url_remap.url_remap_mode to "2" (which is a completely undocumented "feature").
 bool
-request_url_remap(HttpTransact::State * s, HTTPHdr * request_header, char **redirect_url,
char **orig_url,
-                  unsigned int filter_mask)
+request_url_remap(HttpTransact::State * s, HTTPHdr * request_header, char **redirect_url,
unsigned int filter_mask)
 {
   NOWARN_UNUSED(s);
   NOWARN_UNUSED(request_header);
   NOWARN_UNUSED(redirect_url);
-  NOWARN_UNUSED(orig_url);
   NOWARN_UNUSED(filter_mask);
   return false;
   // return rewrite_table ? rewrite_table->Remap(s, request_header, redirect_url, orig_url,
tag, filter_mask) : false;
@@ -118,9 +116,9 @@ request_url_remap(HttpTransact::State * 
    according to the rules in remap.config.
 */
 mapping_type
-request_url_remap_redirect(HTTPHdr *request_header, URL *redirect_url, char **orig_url)
+request_url_remap_redirect(HTTPHdr *request_header, URL *redirect_url)
 {
-  return rewrite_table ? rewrite_table->Remap_redirect(request_header, redirect_url, orig_url)
: NONE;
+  return rewrite_table ? rewrite_table->Remap_redirect(request_header, redirect_url) :
NONE;
 }
 
 bool

Modified: trafficserver/traffic/trunk/proxy/ReverseProxy.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/ReverseProxy.h?rev=1232637&r1=1232636&r2=1232637&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/ReverseProxy.h (original)
+++ trafficserver/traffic/trunk/proxy/ReverseProxy.h Tue Jan 17 23:12:40 2012
@@ -58,10 +58,10 @@ int init_reverse_proxy();
 
 // Both Return true if a remapping was made and false otherwise
 // ebalsa@ Y! -- this happens in the remapProcessor now for the reverse proxy case (not CDN
or BlindTunnel)
-bool request_url_remap(HttpTransact::State *s, HTTPHdr *request_header, char **redirect_url,
char **orig_url,
+bool request_url_remap(HttpTransact::State *s, HTTPHdr *request_header, char **redirect_url,
                        unsigned int filter_mask = URL_REMAP_FILTER_NONE);
 
-mapping_type request_url_remap_redirect(HTTPHdr *request_header, URL *redirect_url, char
**orig_url);
+mapping_type request_url_remap_redirect(HTTPHdr *request_header, URL *redirect_url);
 bool response_url_remap(HTTPHdr *response_header);
 
 // Reload Functions

Modified: trafficserver/traffic/trunk/proxy/http/HttpTransact.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpTransact.cc?rev=1232637&r1=1232636&r2=1232637&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpTransact.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpTransact.cc Tue Jan 17 23:12:40 2012
@@ -511,7 +511,7 @@ how_to_open_connection(HttpTransact::Sta
 
     // TODO yeah, not sure everything here is correct with redirects
     // This probably doesn't work properly, since request_url_remap() is broken.
-    if (request_url_remap(s, &s->hdr_info.server_request, &remap_redirect, &s->unmapped_request_url))
{
+    if (request_url_remap(s, &s->hdr_info.server_request, &remap_redirect)) {
       ink_assert(!remap_redirect);      // should not redirect in this code
       HttpTransact::initialize_state_variables_for_origin_server(s, &s->hdr_info.server_request,
true);
       Debug("cdn", "Converting proxy request to server request");
@@ -635,7 +635,7 @@ HttpTransact::HandleBlindTunnel(State* s
   // TODO: take a look at this
   // This probably doesn't work properly, since request_url_remap() is broken.
   if (url_remap_mode == URL_REMAP_DEFAULT || url_remap_mode == URL_REMAP_ALL) {
-    url_remap_success = request_url_remap(s, &s->hdr_info.client_request, &remap_redirect,
&s->unmapped_request_url);
+    url_remap_success = request_url_remap(s, &s->hdr_info.client_request, &remap_redirect);
   }
   // We must have mapping or we will self loop since the this
   //    request was addressed to us to begin with.  Remap directs
@@ -1090,7 +1090,7 @@ HttpTransact::handleIfRedirect(State *s)
   int answer;
   URL redirect_url;
 
-  answer = request_url_remap_redirect(&s->hdr_info.client_request, &redirect_url,
&s->unmapped_request_url);
+  answer = request_url_remap_redirect(&s->hdr_info.client_request, &redirect_url);
   if ((answer == PERMANENT_REDIRECT) || (answer == TEMPORARY_REDIRECT)) {
     int remap_redirect_len;
     char *remap_redirect;

Modified: trafficserver/traffic/trunk/proxy/http/HttpTransact.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpTransact.h?rev=1232637&r1=1232636&r2=1232637&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpTransact.h (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpTransact.h Tue Jan 17 23:12:40 2012
@@ -947,7 +947,6 @@ public:
     // FilterResult             content_control;
     bool backdoor_request;      // internal
     bool cop_test_page;         // internal
-    char *unmapped_request_url; // in
 
     StateMachineAction_t next_action;   // out
     StateMachineAction_t api_next_action;       // out
@@ -1080,7 +1079,6 @@ public:
         cache_lookup_result(CACHE_LOOKUP_NONE),
         backdoor_request(false),
         cop_test_page(false),
-        unmapped_request_url(0),
         next_action(STATE_MACHINE_ACTION_UNDEFINED),
         api_next_action(STATE_MACHINE_ACTION_UNDEFINED),
         transact_return_point(NULL),
@@ -1200,7 +1198,6 @@ public:
       if (internal_msg_buffer) {
         free_internal_msg_buffer(internal_msg_buffer, internal_msg_buffer_fast_allocator_size);
       }
-      //if (unmapped_request_url) ats_free(unmapped_request_url);
       if (internal_msg_buffer_type)
         ats_free(internal_msg_buffer_type);
 

Modified: trafficserver/traffic/trunk/proxy/http/remap/RemapProcessor.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/RemapProcessor.cc?rev=1232637&r1=1232636&r2=1232637&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/RemapProcessor.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/RemapProcessor.cc Tue Jan 17 23:12:40 2012
@@ -50,7 +50,6 @@ RemapProcessor::setup_for_remap(HttpTran
   bool mapping_found = false;
   HTTPHdr *request_header = &s->hdr_info.client_request;
   char **redirect_url = &s->remap_redirect;
-  char **orig_url = &s->unmapped_request_url;
   const char *request_host;
   int request_host_len;
   int request_port;
@@ -123,17 +122,12 @@ RemapProcessor::setup_for_remap(HttpTran
       mapping_found = rewrite_table->forwardMappingLookup(request_url, 0, "", 0, s->url_map);
     }
 
-    if (mapping_found && orig_url) {
+    if (mapping_found) {
       // Downstream mapping logic (e.g., self::finish_remap())
       // apparently assumes the presence of the target in the URL, so
       // we need to copy it. Perhaps it's because it's simpler to just
       // do the remap on the URL and then fix the field at the end.
       request_header->set_url_target_from_host_field();
-
-      // TODO: This is pretty slow, and only used for logging. Can we by chance avoid
-      // doing this is nothing is known to need it ? Perhaps the log library could
-      // have a table with status of what resources is necessary.
-      *orig_url = request_url->string_get_ref(NULL);
     }
   }
 
@@ -152,7 +146,6 @@ RemapProcessor::finish_remap(HttpTransac
   url_mapping *map = NULL;
   HTTPHdr *request_header = &s->hdr_info.client_request;
   URL *request_url = request_header->url_get();
-  char **orig_url = &s->unmapped_request_url;
   char **redirect_url = &s->remap_redirect;
   const int host_buf_len = MAXDNAME + 12 + 1 + 1;
   char host_hdr_buf[host_buf_len], tmp_referer_buf[4096], tmp_redirect_buf[4096], tmp_buf[2048],
*c;
@@ -219,7 +212,7 @@ RemapProcessor::finish_remap(HttpTransac
               }
               break;
             case 'o':
-              c = *orig_url;
+              c = s->pristine_url.string_get_ref(NULL);
               break;
             };
 

Modified: trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.cc?rev=1232637&r1=1232636&r2=1232637&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.cc Tue Jan 17 23:12:40 2012
@@ -891,7 +891,7 @@ UrlRewrite::PerformACLFiltering(HttpTran
    ought to point to the new, mapped URL when the function exits.
 */
 mapping_type
-UrlRewrite::Remap_redirect(HTTPHdr *request_header, URL *redirect_url, char **orig_url)
+UrlRewrite::Remap_redirect(HTTPHdr *request_header, URL *redirect_url)
 {
   URL *request_url;
   mapping_type mappingType;
@@ -970,7 +970,6 @@ UrlRewrite::Remap_redirect(HTTPHdr *requ
 
   if (mappingType != NONE) {
     ink_assert((mappingType == PERMANENT_REDIRECT) || (mappingType == TEMPORARY_REDIRECT));
-    *orig_url = NULL;
 
     // Make a copy of the request url so that we can munge it
     //   for the redirect

Modified: trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.h?rev=1232637&r1=1232636&r2=1232637&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.h (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/UrlRewrite.h Tue Jan 17 23:12:40 2012
@@ -73,7 +73,7 @@ public:
   UrlRewrite(const char *file_var_in);
   ~UrlRewrite();
   int BuildTable();
-  mapping_type Remap_redirect(HTTPHdr * request_header, URL *redirect_url, char **orig_url);
+  mapping_type Remap_redirect(HTTPHdr * request_header, URL *redirect_url);
   bool ReverseMap(HTTPHdr *response_header);
   void SetReverseFlag(int flag);
   void Print();

Modified: trafficserver/traffic/trunk/proxy/logging/LogAccessHttp.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogAccessHttp.cc?rev=1232637&r1=1232636&r2=1232637&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogAccessHttp.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogAccessHttp.cc Tue Jan 17 23:12:40 2012
@@ -176,11 +176,10 @@ void
 LogAccessHttp::validate_unmapped_url(void)
 {
   if (m_client_req_unmapped_url_canon_len < 0) {
-
-    char *unmapped_url = m_http_sm->t_state.unmapped_request_url;
+    int unmapped_url_len;
+    char *unmapped_url = m_http_sm->t_state.pristine_url.string_get_ref(&unmapped_url_len);
 
     if (unmapped_url && unmapped_url[0] != 0) {
-      int unmapped_url_len =::strlen(unmapped_url);
       m_client_req_unmapped_url_canon_str =
         LogUtils::escapify_url(&m_arena, unmapped_url, unmapped_url_len, &m_client_req_unmapped_url_canon_len);
     } else {



Mime
View raw message