You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2012/05/29 19:38:35 UTC
git commit: TS-1277: IPv6 URL parsing breaks remap configuration.
(cherry picked from commit 403fec8c674d1c2ec1c20df5c999952db14214f1)
Updated Branches:
refs/heads/devrel/3.1.4 9034785cd -> 2e065b296
TS-1277: IPv6 URL parsing breaks remap configuration.
(cherry picked from commit 403fec8c674d1c2ec1c20df5c999952db14214f1)
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/2e065b29
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/2e065b29
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/2e065b29
Branch: refs/heads/devrel/3.1.4
Commit: 2e065b296f102f29fc40342bbb0e3b3a57e6def7
Parents: 9034785
Author: Alan M. Carroll <am...@network-geographics.com>
Authored: Tue May 29 12:38:11 2012 -0500
Committer: Alan M. Carroll <am...@network-geographics.com>
Committed: Tue May 29 12:38:11 2012 -0500
----------------------------------------------------------------------
CHANGES | 2 +
proxy/hdrs/URL.cc | 50 +++++++++++++++++++++++++----------------------
2 files changed, 29 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2e065b29/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 949bf4c..57e0f72 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 3.1.4
+ *) [TS-1277] Fixed issue with IPv6 URLs and remap configuration.
+
*) [TS-1195] Support the use of raw IPv6 address in URLs and Host fields.
*) [TS-1275] Fix startup problem where /var is on a volatile disk.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2e065b29/proxy/hdrs/URL.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/URL.cc b/proxy/hdrs/URL.cc
index 9085b4b..454545a 100644
--- a/proxy/hdrs/URL.cc
+++ b/proxy/hdrs/URL.cc
@@ -1443,32 +1443,36 @@ MIMEParseResult
url_parse_http_no_path_component_breakdown(HdrHeap * heap,
URLImpl * url, const char **start, const char *end, bool copy_strings)
{
- MIMEParseResult err;
- const char *cur;
- const char *path_start = NULL;
- const char *path_end = NULL;
-
- err = url_parse_internet(heap, url, start, end, copy_strings);
- if (err < 0)
- return err;
-
- cur = *start;
- if (*start == end)
- goto done;
-
- path_start = cur;
-parse_path2:
- GETNEXT(done);
- goto parse_path2;
+ const char *cur = *start;
+ char const* host_end;
-done:
- if (path_start) {
- if (!path_end)
- path_end = cur;
- url_path_set(heap, url, path_start, path_end - path_start, copy_strings);
+ // Do a quick check for "://" - our only format check.
+ if (end - cur > 3 &&
+ (((':' ^ *cur) | ('/' ^ cur[1]) | ('/' ^ cur[2])) == 0)) {
+ cur += 3;
+ } else if (':' == *cur && (++cur >= end ||
+ ('/' == *cur && (++cur >= end ||
+ ('/' == *cur && ++cur >= end))))) {
+ return PARSE_ERROR;
}
- *start = cur;
+ // Grab everything until EOS or slash.
+ char const* base = cur;
+ cur = static_cast<char const*>(memchr(cur, '/', end - cur));
+ if (cur) {
+ host_end = cur;
+ ++cur;
+ } else {
+ host_end = end;
+ }
+ if (base != host_end)
+ url_host_set(heap, url, base, host_end - base, copy_strings);
+ cur = host_end;
+
+ // path is anything that's left.
+ if (cur < end)
+ url_path_set(heap, url, cur, end - cur, copy_strings);
+ *start = end;
return PARSE_DONE;
}