mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1590447 - Fix FTP hang with RETR/STOR. r=michal
Differential Revision: https://phabricator.services.mozilla.com/D50082 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
d8758a92f8
commit
6172ff50e8
@ -82,6 +82,8 @@ nsFtpState::nsFtpState()
|
||||
mRetryPass(false),
|
||||
mStorReplyReceived(false),
|
||||
mRlist1xxReceived(false),
|
||||
mRretr1xxReceived(false),
|
||||
mRstor1xxReceived(false),
|
||||
mInternalError(NS_OK),
|
||||
mReconnectAndLoginAgain(false),
|
||||
mCacheConnection(true),
|
||||
@ -1095,8 +1097,12 @@ nsresult nsFtpState::S_retr() {
|
||||
FTP_STATE
|
||||
nsFtpState::R_retr() {
|
||||
if (mResponseCode / 100 == 2) {
|
||||
if (!mRretr1xxReceived)
|
||||
return FTP_ERROR;
|
||||
|
||||
//(DONE)
|
||||
mNextState = FTP_COMPLETE;
|
||||
mRretr1xxReceived = false;
|
||||
return FTP_COMPLETE;
|
||||
}
|
||||
|
||||
@ -1104,6 +1110,8 @@ nsFtpState::R_retr() {
|
||||
Telemetry::ScalarAdd(
|
||||
Telemetry::ScalarID::NETWORKING_FTP_OPENED_CHANNELS_FILES, 1);
|
||||
|
||||
mRretr1xxReceived = true;
|
||||
|
||||
if (mDataStream && HasPendingCallback())
|
||||
mDataStream->AsyncWait(this, 0, 0, CallbackTarget());
|
||||
return FTP_READ_BUF;
|
||||
@ -1172,10 +1180,11 @@ nsresult nsFtpState::S_stor() {
|
||||
|
||||
FTP_STATE
|
||||
nsFtpState::R_stor() {
|
||||
if (mResponseCode / 100 == 2) {
|
||||
if (mResponseCode / 100 == 2 && mRstor1xxReceived) {
|
||||
//(DONE)
|
||||
mNextState = FTP_COMPLETE;
|
||||
mStorReplyReceived = true;
|
||||
mRstor1xxReceived = false;
|
||||
|
||||
// Call Close() if it was not called in nsFtpState::OnStoprequest()
|
||||
if (!mUploadRequest && !IsClosed()) Close();
|
||||
@ -1188,6 +1197,7 @@ nsFtpState::R_stor() {
|
||||
Telemetry::ScalarID::NETWORKING_FTP_OPENED_CHANNELS_FILES, 1);
|
||||
|
||||
LOG(("FTP:(%p) writing on DT\n", this));
|
||||
mRstor1xxReceived = true;
|
||||
return FTP_READ_BUF;
|
||||
}
|
||||
|
||||
|
@ -218,6 +218,10 @@ class nsFtpState final : public nsBaseContentStream,
|
||||
// completion status from server
|
||||
bool mRlist1xxReceived; // TRUE if we have received a LIST 1xx
|
||||
// response from the server
|
||||
bool mRretr1xxReceived; // TRUE if we have received a RETR 1xx
|
||||
// response from the server
|
||||
bool mRstor1xxReceived; // TRUE if we have received a STOR 1xx
|
||||
// response from the server
|
||||
nsresult mInternalError; // represents internal state errors
|
||||
bool mReconnectAndLoginAgain;
|
||||
bool mCacheConnection;
|
||||
|
Loading…
Reference in New Issue
Block a user