From 1342aa72c90df768476b7ddba19f5654dee2e04c Mon Sep 17 00:00:00 2001 From: "julian.reschke@gmx.de" Date: Thu, 22 Sep 2011 17:35:24 +0100 Subject: [PATCH] Bug 682762 - FTP URI with param component no longer works; r=rjesup --- .../protocol/ftp/nsFtpConnectionThread.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp index 3590a11256a..c834bbab1d2 100644 --- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp @@ -74,6 +74,16 @@ extern PRLogModuleInfo* gFTPLog; #define LOG(args) PR_LOG(gFTPLog, PR_LOG_DEBUG, args) #define LOG_ALWAYS(args) PR_LOG(gFTPLog, PR_LOG_ALWAYS, args) +// remove FTP parameters (starting with ";") from the path +static void +removeParamsFromPath(nsCString& path) +{ + PRInt32 index = path.FindChar(';'); + if (index >= 0) { + path.SetLength(index); + } +} + NS_IMPL_ISUPPORTS_INHERITED4(nsFtpState, nsBaseContentStream, nsIInputStreamCallback, @@ -1696,6 +1706,15 @@ nsFtpState::Init(nsFtpChannel *channel) if (NS_FAILED(rv)) return rv; + removeParamsFromPath(path); + + // FTP parameters such as type=i are ignored + if (url) { + url->SetFilePath(path); + } else { + mChannel->URI()->SetPath(path); + } + // Skip leading slash char *fwdPtr = path.BeginWriting(); if (!fwdPtr)