------------------------------------------------------------ revno: 13402 revision-id: squid3@treenet.co.nz-20140508101741-4veachmn9jloqrsj parent: squidadm@squid-cache.org-20140507144005-hdwjmfjo5vtu0ljq fixes bug(s): http://bugs.squid-cache.org/show_bug.cgi?id=4059 author: Timo Tseras committer: Amos Jeffries branch nick: trunk timestamp: Thu 2014-05-08 03:17:41 -0700 message: Bug 4059: Support redirectors and logging using Squid-2 urlgroup feature ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20140508101741-4veachmn9jloqrsj # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 29fd7720ee5a99d235591d63db97523312b2cce9 # timestamp: 2014-05-08 11:00:17 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squidadm@squid-cache.org-20140507144005-\ # hdwjmfjo5vtu0ljq # # Begin patch === modified file 'src/format/ByteCode.h' --- src/format/ByteCode.h 2014-05-07 10:05:58 +0000 +++ src/format/ByteCode.h 2014-05-08 10:17:41 +0000 @@ -72,6 +72,7 @@ /*LFT_REQUEST_QUERY, */ LFT_REQUEST_VERSION_OLD_2X, LFT_REQUEST_VERSION, + LFT_REQUEST_URLGROUP_OLD_2X, /* request header details pre-adaptation */ LFT_REQUEST_HEADER, === modified file 'src/format/Format.cc' --- src/format/Format.cc 2014-05-07 14:40:05 +0000 +++ src/format/Format.cc 2014-05-08 10:17:41 +0000 @@ -1136,6 +1136,9 @@ break; #endif + case LFT_REQUEST_URLGROUP_OLD_2X: + assert(LFT_REQUEST_URLGROUP_OLD_2X == 0); // should never happen. + case LFT_NOTE: tmp[0] = fmt->data.header.separator; tmp[1] = '\0'; === modified file 'src/format/Token.cc' --- src/format/Token.cc 2014-05-07 14:40:05 +0000 +++ src/format/Token.cc 2014-05-08 10:17:41 +0000 @@ -93,6 +93,7 @@ {"rp", LFT_REQUEST_URLPATH_OLD_31}, /* { "rq", LFT_REQUEST_QUERY }, * / / * the query-string, INCLUDING the leading ? */ {"rv", LFT_REQUEST_VERSION}, + {"rG", LFT_REQUEST_URLGROUP_OLD_2X}, {"(atoi(result)); + char * result = reply.modifiableOther().content(); HelperReply newReply; // BACKWARD COMPATIBILITY 2012-06-15: @@ -142,6 +141,20 @@ newReply.result = HelperReply::Okay; newReply.notes.append(&reply.notes); + // check and parse for obsoleted Squid-2 urlgroup feature + if (*result == '!') { + static int urlgroupWarning = 0; + if (!urlgroupWarning++) + debugs(85, DBG_IMPORTANT, "UPGRADE WARNING: URL rewriter using obsolete Squid-2 urlgroup feature needs updating."); + if (char *t = strchr(result+1, '!')) { + *t = '\0'; + newReply.notes.add("urlgroup", result+1); + result = t + 1; + } + } + + const Http::StatusCode status = static_cast(atoi(result)); + if (status == Http::scMovedPermanently || status == Http::scFound || status == Http::scSeeOther @@ -162,7 +175,8 @@ // status code is not a redirect code (or does not exist) // treat as a re-write URL request // TODO: validate the URL produced here is RFC 2616 compliant URI - newReply.notes.add("rewrite-url", reply.other().content()); + if (*result) + newReply.notes.add("rewrite-url", result); } void *cbdata;