From: Christos Tsantilas Date: Fri, 13 Dec 2013 18:05:59 +0000 (+0200) Subject: Urls contain ipv6 ipaddresses may not logged correctly X-Git-Tag: SQUID_3_5_0_1~117^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb8b595438f2882cd64a292cc5b26463e7d2e553;p=thirdparty%2Fsquid.git Urls contain ipv6 ipaddresses may not logged correctly The urls which include an ipv6 address as hostname does not logged correctly in the following cases: - When a user is already logged in to an ftp server and a new USER command entered with ipv6 address as hostname the logged url does not put ipv6 address inside brackets ([]). - On FTP error responses generated by squid the url which includes ipv6 addresses apearred with brackets urlencoded. eg: ftp://%5B::1%5D/ --- diff --git a/src/client_side.cc b/src/client_side.cc index 4fc2920a24..0e2691399f 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -5857,7 +5857,7 @@ FtpHandleUserRequest(ConnStateData *connState, const String &cmd, String ¶ms } const String login = params.substr(0, eou); - const String host = params.substr(eou + 1, params.size()); + String host = params.substr(eou + 1, params.size()); // If we can parse it as raw IPv6 address, then surround with "[]". // Otherwise (domain, IPv4, [bracketed] IPv6, garbage, etc), use as is. if (host.pos(":")) { @@ -5866,7 +5866,7 @@ FtpHandleUserRequest(ConnStateData *connState, const String &cmd, String ¶ms ipa = host.termedBuf(); if (!ipa.isAnyAddr()) { ipa.toHostStr(ipBuf, MAX_IPSTRLEN); - connState->ftp.host = ipBuf; + host = ipBuf; } } connState->ftp.host = host; @@ -6200,7 +6200,7 @@ FtpSetReply(ClientSocketContext *context, const int code, const char *msg) header.putStr(HDR_FTP_REASON, msg); reply->hdrCacheInit(); - setLogUri(http, http->uri, true); + setLogUri(http, http->uri); clientStreamNode *const node = context->getClientReplyContext(); clientReplyContext *const repContext =