зеркало из https://github.com/mozilla/pjs.git
Bug 389394. Fix FTP upload of small files to properly report failures. r+sr=bzbarsky
This commit is contained in:
Родитель
2582f9078e
Коммит
413147d06f
|
@ -94,6 +94,7 @@ nsFtpState::nsFtpState()
|
|||
, mAction(GET)
|
||||
, mAnonymous(PR_TRUE)
|
||||
, mRetryPass(PR_FALSE)
|
||||
, mStorReplyReceived(PR_FALSE)
|
||||
, mInternalError(NS_OK)
|
||||
, mPort(21)
|
||||
, mAddressChecked(PR_FALSE)
|
||||
|
@ -1228,6 +1229,12 @@ nsFtpState::R_stor() {
|
|||
if (mResponseCode/100 == 2) {
|
||||
//(DONE)
|
||||
mNextState = FTP_COMPLETE;
|
||||
mStorReplyReceived = PR_TRUE;
|
||||
|
||||
// Call Close() if it was not called in nsFtpState::OnStoprequest()
|
||||
if (!mUploadRequest && !IsClosed())
|
||||
Close();
|
||||
|
||||
return FTP_COMPLETE;
|
||||
}
|
||||
|
||||
|
@ -1236,6 +1243,7 @@ nsFtpState::R_stor() {
|
|||
return FTP_READ_BUF;
|
||||
}
|
||||
|
||||
mStorReplyReceived = PR_TRUE;
|
||||
return FTP_ERROR;
|
||||
}
|
||||
|
||||
|
@ -1962,6 +1970,7 @@ nsFtpState::OnCacheEntryAvailable(nsICacheEntryDescriptor *entry,
|
|||
NS_IMETHODIMP
|
||||
nsFtpState::OnStartRequest(nsIRequest *request, nsISupports *context)
|
||||
{
|
||||
mStorReplyReceived = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1971,6 +1980,11 @@ nsFtpState::OnStopRequest(nsIRequest *request, nsISupports *context,
|
|||
{
|
||||
mUploadRequest = nsnull;
|
||||
|
||||
// Close() will be called when reply to STOR command is received
|
||||
// see bug #389394
|
||||
if (!mStorReplyReceived)
|
||||
return NS_OK;
|
||||
|
||||
// We're done uploading. Let our consumer know that we're done.
|
||||
Close();
|
||||
return NS_OK;
|
||||
|
|
|
@ -266,6 +266,8 @@ private:
|
|||
FTP_ACTION mAction; // the higher level action (GET/PUT)
|
||||
PRPackedBool mAnonymous; // try connecting anonymous (default)
|
||||
PRPackedBool mRetryPass; // retrying the password
|
||||
PRPackedBool mStorReplyReceived; // FALSE if waiting for STOR
|
||||
// completion status from server
|
||||
nsresult mInternalError; // represents internal state errors
|
||||
|
||||
// ****** URI vars
|
||||
|
|
Загрузка…
Ссылка в новой задаче