diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-07-08 16:40:21 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-07-08 16:40:21 +0000 |
| commit | 52a6ea008e18978eb087050ca6095260817ab7cb (patch) | |
| tree | 72c2e75f06b41fa7651315dab061e1dfc9a7c7bc /src/FtpConnection.cc | |
| parent | 880af94348cca47cdb3f4e89a3759c884942cde8 (diff) | |
2010-07-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that aria2 cannot handle %2F in FTP URI properly.
If directory component starts with %2F which percent-encode of
'/', client should issue CWD to absolute path, but aria2 does not
do that. It just issues relative path and download fails.
* src/FtpConnection.cc
* test/FtpConnectionTest.cc
Diffstat (limited to 'src/FtpConnection.cc')
| -rw-r--r-- | src/FtpConnection.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/FtpConnection.cc b/src/FtpConnection.cc index 2c454a32..0aaa9a4a 100644 --- a/src/FtpConnection.cc +++ b/src/FtpConnection.cc @@ -150,10 +150,14 @@ bool FtpConnection::sendCwd() util::itos(cuid_).c_str(), baseWorkingDir_.c_str()); } std::string request = "CWD "; - if(baseWorkingDir_ != "/") { - request += baseWorkingDir_; + if(util::startsWith(util::toUpper(req_->getDir()), "/%2F")) { + request += util::percentDecode(req_->getDir().substr(1)); + } else { + if(baseWorkingDir_ != "/") { + request += baseWorkingDir_; + } + request += util::percentDecode(req_->getDir()); } - request += util::percentDecode(req_->getDir()); request += "\r\n"; if(logger_->info()) { logger_->info(MSG_SENDING_REQUEST, |
