From 21c328fc113d28f3bbb1b1d74b53e4e2a36c4e9d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 12 May 2015 00:32:08 +0900 Subject: sftp: Make sftp works through HTTP proxy --- src/FtpInitiateConnectionCommand.cc | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/FtpInitiateConnectionCommand.cc') diff --git a/src/FtpInitiateConnectionCommand.cc b/src/FtpInitiateConnectionCommand.cc index 3950fed0..78c0ca0c 100644 --- a/src/FtpInitiateConnectionCommand.cc +++ b/src/FtpInitiateConnectionCommand.cc @@ -132,18 +132,31 @@ std::unique_ptr FtpInitiateConnectionCommand::createNextCommandProxied setConnectedAddrInfo(getRequest(), hostname, pooledSocket); if(proxyMethod == V_TUNNEL) { + if (getRequest()->getProtocol() == "sftp") { + return make_unique + (getCuid(), + getRequest(), + getFileEntry(), + getRequestGroup(), + getDownloadEngine(), + pooledSocket, + SftpNegotiationCommand::SEQ_SFTP_OPEN); + } + // options contains "baseWorkingDir" return make_unique (getCuid(), - getRequest(), - getFileEntry(), - getRequestGroup(), - getDownloadEngine(), - pooledSocket, - FtpNegotiationCommand::SEQ_SEND_CWD_PREP, - options); + getRequest(), + getFileEntry(), + getRequestGroup(), + getDownloadEngine(), + pooledSocket, + FtpNegotiationCommand::SEQ_SEND_CWD_PREP, + options); } + assert(getRequest()->getProtocol() == "ftp"); + if(proxyMethod != V_GET) { assert(0); return nullptr; -- cgit