зеркало из https://github.com/mozilla/pjs.git
Fixes 78279, 77939. r=gagan@netscape.com, sr=darin@netscape.com
This commit is contained in:
Родитель
de6cfe3ff7
Коммит
6a44ba717c
|
@ -59,7 +59,7 @@ extern PRLogModuleInfo* gFTPLog;
|
|||
#endif /* PR_LOGGING */
|
||||
|
||||
|
||||
class DataRequestForwarder : public nsIChannel,
|
||||
class DataRequestForwarder : public nsIFTPChannel,
|
||||
public nsIStreamListener,
|
||||
public nsIInterfaceRequestor,
|
||||
public nsIProgressEventSink
|
||||
|
@ -78,14 +78,15 @@ public:
|
|||
NS_DECL_NSIPROGRESSEVENTSINK
|
||||
|
||||
NS_FORWARD_NSIREQUEST(mRequest->)
|
||||
NS_FORWARD_NSICHANNEL(mChannel->)
|
||||
NS_FORWARD_NSICHANNEL(mFTPChannel->)
|
||||
NS_FORWARD_NSIFTPCHANNEL(mFTPChannel->)
|
||||
|
||||
PRUint32 GetBytesTransfered() {return mBytesTransfered;} ;
|
||||
|
||||
protected:
|
||||
|
||||
nsCOMPtr<nsIRequest> mRequest;
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
nsCOMPtr<nsIFTPChannel> mFTPChannel;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
nsCOMPtr<nsIProgressEventSink> mEventSink;
|
||||
|
||||
|
@ -99,10 +100,11 @@ protected:
|
|||
// the socket transport so that clients only see
|
||||
// the same nsIChannel/nsIRequest that they started.
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS6(DataRequestForwarder,
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS7(DataRequestForwarder,
|
||||
nsIStreamListener,
|
||||
nsIRequestObserver,
|
||||
nsIChannel,
|
||||
nsIFTPChannel,
|
||||
nsIChannel,
|
||||
nsIRequest,
|
||||
nsIInterfaceRequestor,
|
||||
nsIProgressEventSink);
|
||||
|
@ -143,11 +145,12 @@ DataRequestForwarder::Init(nsIRequest *request)
|
|||
NS_ENSURE_ARG(request);
|
||||
|
||||
// for the forwarding declarations.
|
||||
mRequest = request;
|
||||
mChannel = do_QueryInterface(request);
|
||||
mEventSink= do_QueryInterface(request);
|
||||
|
||||
if (!mRequest || !mChannel)
|
||||
mRequest = request;
|
||||
mFTPChannel = do_QueryInterface(request);
|
||||
mEventSink = do_QueryInterface(request);
|
||||
mListener = do_QueryInterface(request);
|
||||
|
||||
if (!mRequest || !mFTPChannel)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1135,6 +1138,10 @@ nsFtpState::S_list() {
|
|||
mResponseMsg = "";
|
||||
return rv;
|
||||
}
|
||||
|
||||
// the data forwarder defaults to sending notifications
|
||||
// to the channel. Lets hijack and send the notifications
|
||||
// to the stream converter.
|
||||
mDRequestForwarder->SetStreamListener(converter);
|
||||
|
||||
nsCAutoString listString("LIST" CRLF);
|
||||
|
@ -1161,8 +1168,6 @@ nsFtpState::S_retr() {
|
|||
if (!mDRequestForwarder)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIStreamListener> streamListener = do_QueryInterface(mChannel);
|
||||
mDRequestForwarder->SetStreamListener(streamListener);
|
||||
rv = SendFTPCommand(retrStr);
|
||||
return rv;
|
||||
}
|
||||
|
@ -1587,9 +1592,15 @@ nsFtpState::Init(nsIFTPChannel* aChannel,
|
|||
|
||||
rv = aChannel->GetURI(getter_AddRefs(mURL));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
char *path = nsnull;
|
||||
rv = mURL->GetPath(&path);
|
||||
|
||||
char *path = nsnull;
|
||||
nsCOMPtr<nsIURL> aURL(do_QueryInterface(mURL));
|
||||
|
||||
if (aURL)
|
||||
rv = aURL->GetFilePath(&path);
|
||||
else
|
||||
rv = mURL->GetPath(&path);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
mPath = nsUnescape(path);
|
||||
nsMemory::Free(path);
|
||||
|
@ -1730,7 +1741,11 @@ nsFtpState::StopProcessing() {
|
|||
|
||||
NS_ASSERTION(mPrompter, "no prompter!");
|
||||
if (mPrompter)
|
||||
(void) mPrompter->Alert(nsnull, text.GetUnicode());
|
||||
(void) mPrompter->Alert(nsnull, text.GetUnicode());
|
||||
#if DEBUG
|
||||
else
|
||||
printf("NO ALERT! FTP error: %s", text.get());
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( NS_FAILED(mControlStatus) ) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче