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 2012/03/24 04:36:55 UTC

git commit: TS-1150 Some more minor cleanup

Updated Branches:
  refs/heads/master 601490423 -> 7d6d26307


TS-1150 Some more minor cleanup


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7d6d2630
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7d6d2630
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7d6d2630

Branch: refs/heads/master
Commit: 7d6d263075e7746c65068fdde05d5f9aa578df22
Parents: 6014904
Author: Leif Hedstrom <le...@ogre.com>
Authored: Fri Mar 23 21:36:16 2012 -0600
Committer: Leif Hedstrom <le...@ogre.com>
Committed: Fri Mar 23 21:36:16 2012 -0600

----------------------------------------------------------------------
 proxy/ReverseProxy.cc              |    1 -
 proxy/hdrs/HdrHeap.cc              |    1 -
 proxy/http/remap/RemapPlugins.cc   |    4 ++--
 proxy/http/remap/RemapProcessor.cc |   23 ++++++++++-------------
 proxy/http/remap/UrlMapping.cc     |   17 +++++++++--------
 proxy/http/remap/UrlRewrite.h      |    1 -
 6 files changed, 21 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d6d2630/proxy/ReverseProxy.cc
----------------------------------------------------------------------
diff --git a/proxy/ReverseProxy.cc b/proxy/ReverseProxy.cc
index 15c83a3..185f3c5 100644
--- a/proxy/ReverseProxy.cc
+++ b/proxy/ReverseProxy.cc
@@ -43,7 +43,6 @@
 #include "RemapProcessor.h"
 #include "UrlRewrite.h"
 #include "UrlMapping.h"
-#include "StringHash.h"
 #include "ink_unused.h"      /* MAGIC_EDITING_TAG */
 
 /** Time till we free the old stuff after a reconfiguration. */

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d6d2630/proxy/hdrs/HdrHeap.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/HdrHeap.cc b/proxy/hdrs/HdrHeap.cc
index 997fa1f..9392290 100644
--- a/proxy/hdrs/HdrHeap.cc
+++ b/proxy/hdrs/HdrHeap.cc
@@ -167,7 +167,6 @@ new_HdrStrHeap(int requested_size)
 
   ink_assert(sh->m_free_size > 0);
 
-
   return sh;
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d6d2630/proxy/http/remap/RemapPlugins.cc
----------------------------------------------------------------------
diff --git a/proxy/http/remap/RemapPlugins.cc b/proxy/http/remap/RemapPlugins.cc
index 0a701a0..7289d9d 100644
--- a/proxy/http/remap/RemapPlugins.cc
+++ b/proxy/http/remap/RemapPlugins.cc
@@ -151,7 +151,6 @@ RemapPlugins::run_single_remap()
     int toPathLen;
     int toHostLen;
 
-    map_from->path_get(&fromPathLen);
     toHost = map_to->host_get(&toHostLen);
     toPath = map_to->path_get(&toPathLen);
 
@@ -168,6 +167,7 @@ RemapPlugins::run_single_remap()
     if (to_scheme != map_from->scheme_get(&from_scheme_len))
       _request_url->scheme_set(to_scheme, to_scheme_len);
 
+    map_from->path_get(&fromPathLen);
     requestPath = _request_url->path_get(&requestPathLen);
     // Extra byte is potentially needed for prefix path '/'.
     // Added an extra 3 so that TS wouldn't crash in the field.
@@ -235,7 +235,7 @@ RemapPlugins::run_single_remap()
     _request_url->path_set(newPath, newPathLen);
 
     // TODO: This is horribly wrong and broken, when can this trigger??? Check
-    // above, we already return on _s->remap_redirect ... 
+    // above, we already return on _s->remap_redirect ... XXX.
     if (map->homePageRedirect && fromPathLen == requestPathLen && _s->remap_redirect) {
       URL redirect_url;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d6d2630/proxy/http/remap/RemapProcessor.cc
----------------------------------------------------------------------
diff --git a/proxy/http/remap/RemapProcessor.cc b/proxy/http/remap/RemapProcessor.cc
index 2d31240..80c8a32 100644
--- a/proxy/http/remap/RemapProcessor.cc
+++ b/proxy/http/remap/RemapProcessor.cc
@@ -201,11 +201,9 @@ RemapProcessor::finish_remap(HttpTransact::State *s)
               break;
             case 'f':
             case 't':
-              remapped_host =
-                (rc->type == 'f') ? map->fromURL.string_get_buf(tmp_buf, (int) sizeof(tmp_buf),
-                                                                &from_len) : ((s->url_map).getToURL())->string_get_buf(tmp_buf, (int)
-                                                                                                       sizeof(tmp_buf),
-                                                                                                       &from_len);
+              remapped_host = (rc->type == 'f') ?
+                map->fromURL.string_get_buf(tmp_buf, (int) sizeof(tmp_buf), &from_len) :
+                ((s->url_map).getToURL())->string_get_buf(tmp_buf, (int)sizeof(tmp_buf), &from_len);
               if (remapped_host && from_len > 0) {
                 c = &tmp_buf[0];
               }
@@ -227,8 +225,8 @@ RemapProcessor::finish_remap(HttpTransact::State *s)
       }
 
       if (*redirect_url == NULL) {
-        *redirect_url =
-          ats_strdup(map->filter_redirect_url ? map->filter_redirect_url : rewrite_table->http_default_redirect_url);
+        *redirect_url = ats_strdup(map->filter_redirect_url ? map->filter_redirect_url :
+                                   rewrite_table->http_default_redirect_url);
       }
 
       return false;
@@ -243,17 +241,13 @@ RemapProcessor::finish_remap(HttpTransact::State *s)
   const char *host_hdr = request_header->value_get(MIME_FIELD_HOST, MIME_LEN_HOST, &host_len);
 
   if (request_url && host_hdr != NULL && s->txn_conf->maintain_pristine_host_hdr == 0) {
-    remapped_host = request_url->host_get(&remapped_host_len);
-    remapped_port = request_url->port_get_raw();
-
     // Debug code to print out old host header.  This was easier before
     //  the header conversion.  Now we have to copy to gain null
     //  termination for the Debug() call
     if (is_debug_tag_set("url_rewrite")) {
       int old_host_hdr_len;
-      char *old_host_hdr = (char *) request_header->value_get(MIME_FIELD_HOST,
-                                                              MIME_LEN_HOST,
-                                                              &old_host_hdr_len);
+      char *old_host_hdr = (char *) request_header->value_get(MIME_FIELD_HOST, MIME_LEN_HOST, &old_host_hdr_len);
+
       if (old_host_hdr) {
         old_host_hdr = ats_strndup(old_host_hdr, old_host_hdr_len);
         Debug("url_rewrite", "Host: Header before rewrite %.*s", old_host_hdr_len, old_host_hdr);
@@ -264,6 +258,9 @@ RemapProcessor::finish_remap(HttpTransact::State *s)
     // Create the new host header field being careful that our
     //   temporary buffer has adequate length
     //
+    remapped_host = request_url->host_get(&remapped_host_len);
+    remapped_port = request_url->port_get_raw();
+
     if (TS_MAX_HOST_NAME_LEN > remapped_host_len) {
       tmp = remapped_host_len;
       memcpy(host_hdr_buf, remapped_host, remapped_host_len);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d6d2630/proxy/http/remap/UrlMapping.cc
----------------------------------------------------------------------
diff --git a/proxy/http/remap/UrlMapping.cc b/proxy/http/remap/UrlMapping.cc
index 191602d..fe95166 100644
--- a/proxy/http/remap/UrlMapping.cc
+++ b/proxy/http/remap/UrlMapping.cc
@@ -21,6 +21,7 @@
   limitations under the License.
  */
 
+#include "ink_port.h"
 #include "UrlMapping.h"
 
 /**
@@ -121,7 +122,7 @@ url_mapping::~url_mapping()
 void
 url_mapping::Print()
 {
-  char from_url_buf[32768], to_url_buf[32768];
+  char from_url_buf[131072], to_url_buf[131072];
 
   fromURL.string_get_buf(from_url_buf, (int) sizeof(from_url_buf));
   toUrl.string_get_buf(to_url_buf, (int) sizeof(to_url_buf));
@@ -178,13 +179,13 @@ redirect_tag_str::parse_format_redirect_url(char *url)
 /**
  *
 **/
-referer_info::referer_info(char *_ref, bool *error_flag, char *errmsgbuf, int errmsgbuf_size):
-next(0),
-referer(0),
-referer_size(0),
-any(false),
-negative(false),
-regx_valid(false)
+referer_info::referer_info(char *_ref, bool *error_flag, char *errmsgbuf, int errmsgbuf_size)
+  : next(0),
+    referer(0),
+    referer_size(0),
+    any(false),
+    negative(false),
+    regx_valid(false)
 {
   const char *error;
   int erroffset;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d6d2630/proxy/http/remap/UrlRewrite.h
----------------------------------------------------------------------
diff --git a/proxy/http/remap/UrlRewrite.h b/proxy/http/remap/UrlRewrite.h
index 748d99a..4a89f37 100644
--- a/proxy/http/remap/UrlRewrite.h
+++ b/proxy/http/remap/UrlRewrite.h
@@ -24,7 +24,6 @@
 #ifndef _URL_REWRITE_H_
 #define _URL_REWRITE_H_
 
-#include "StringHash.h"
 #include "UrlMapping.h"
 #include "HttpTransact.h"