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 00:02:08 UTC
git commit: TS-1150 Use TS_MAX_HOST_NAME_LEN instead of an arbitrary
size
Updated Branches:
refs/heads/master 793f3cfc0 -> c08ce26f6
TS-1150 Use TS_MAX_HOST_NAME_LEN instead of an arbitrary size
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c08ce26f
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c08ce26f
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c08ce26f
Branch: refs/heads/master
Commit: c08ce26f6cf8c8b4bfe6b7bc12eb1bfe5dc4a1b5
Parents: 793f3cf
Author: Leif Hedstrom <le...@ogre.com>
Authored: Fri Mar 23 17:01:55 2012 -0600
Committer: Leif Hedstrom <le...@ogre.com>
Committed: Fri Mar 23 17:01:55 2012 -0600
----------------------------------------------------------------------
proxy/http/remap/RemapProcessor.cc | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c08ce26f/proxy/http/remap/RemapProcessor.cc
----------------------------------------------------------------------
diff --git a/proxy/http/remap/RemapProcessor.cc b/proxy/http/remap/RemapProcessor.cc
index 16893bb..2d31240 100644
--- a/proxy/http/remap/RemapProcessor.cc
+++ b/proxy/http/remap/RemapProcessor.cc
@@ -147,8 +147,7 @@ RemapProcessor::finish_remap(HttpTransact::State *s)
HTTPHdr *request_header = &s->hdr_info.client_request;
URL *request_url = request_header->url_get();
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;
+ char host_hdr_buf[TS_MAX_HOST_NAME_LEN], tmp_referer_buf[4096], tmp_redirect_buf[4096], tmp_buf[2048], *c;
const char *remapped_host;
int remapped_host_len, remapped_port, tmp;
int from_len;
@@ -265,21 +264,22 @@ RemapProcessor::finish_remap(HttpTransact::State *s)
// Create the new host header field being careful that our
// temporary buffer has adequate length
//
- if (host_buf_len > remapped_host_len) {
+ if (TS_MAX_HOST_NAME_LEN > remapped_host_len) {
tmp = remapped_host_len;
memcpy(host_hdr_buf, remapped_host, remapped_host_len);
if (remapped_port) {
- tmp += snprintf(host_hdr_buf + remapped_host_len, host_buf_len - remapped_host_len - 1, ":%d", remapped_port);
+ tmp += snprintf(host_hdr_buf + remapped_host_len, TS_MAX_HOST_NAME_LEN - remapped_host_len - 1,
+ ":%d", remapped_port);
}
} else {
- tmp = host_buf_len;
+ tmp = TS_MAX_HOST_NAME_LEN;
}
// It is possible that the hostname is too long. If it is punt,
// and remove the host header. If it is too long the HostDB
// won't be able to resolve it and the request will not go
// through
- if (tmp >= host_buf_len) {
+ if (tmp >= TS_MAX_HOST_NAME_LEN) {
request_header->field_delete(MIME_FIELD_HOST, MIME_LEN_HOST);
Debug("url_rewrite", "Host: Header too long after rewrite");
} else {