From 413b61c316d6d3b361c86c812d1d654c6a4f6acf Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 10 Dec 2011 17:57:31 +0900 Subject: [PATCH] FTP PASV: fixed IPv6 support. If fake FTP URI cannot be parsed (this should not happen), throw exception. --- src/FtpNegotiationCommand.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index e5deafe8..37980f58 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -718,13 +718,14 @@ bool FtpNegotiationCommand::sendTunnelRequest() SharedHandle req(new Request()); // Construct fake URI in order to use HttpRequest std::pair dataAddr; - int family = getSocket()->getPeerInfo(dataAddr); uri::UriStruct us; us.protocol = "ftp"; us.host = getRequest()->getHost(); us.port = pasvPort_; - us.ipv6LiteralAddress = (family == AF_INET6); - req->setUri(uri::construct(us)); + us.ipv6LiteralAddress = getRequest()->isIPv6LiteralAddress(); + if(!req->setUri(uri::construct(us))) { + throw DL_RETRY_EX("Something wrong with FTP URI"); + } httpRequest->setRequest(req); httpRequest->setProxyRequest(createProxyRequest()); http_->sendProxyRequest(httpRequest);