]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Urls contain ipv6 ipaddresses may not logged correctly
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Fri, 13 Dec 2013 18:05:59 +0000 (20:05 +0200)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Fri, 13 Dec 2013 18:05:59 +0000 (20:05 +0200)
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/

src/client_side.cc

index 4fc2920a24b7a8c07604fddb595fee93ccf6d7be..0e2691399f66d9966160e3d1fa585cbe56f756a9 100644 (file)
@@ -5857,7 +5857,7 @@ FtpHandleUserRequest(ConnStateData *connState, const String &cmd, String &params
     }
 
     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 &params
         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 =