Stop 2xx FTP responses from causing browser to hang.
This commit is contained in:
parent
ebb1f27dc6
commit
e52fc12b05
|
@ -82,6 +82,9 @@ nsFtpState::nsFtpState()
|
||||||
, mAnonymous(true)
|
, mAnonymous(true)
|
||||||
, mRetryPass(false)
|
, mRetryPass(false)
|
||||||
, mStorReplyReceived(false)
|
, mStorReplyReceived(false)
|
||||||
|
, mRlist1xxReceived(false)
|
||||||
|
, mRstor1xxReceived(false)
|
||||||
|
, mRretr1xxReceived(false)
|
||||||
, mInternalError(NS_OK)
|
, mInternalError(NS_OK)
|
||||||
, mReconnectAndLoginAgain(false)
|
, mReconnectAndLoginAgain(false)
|
||||||
, mCacheConnection(true)
|
, mCacheConnection(true)
|
||||||
|
@ -1153,15 +1156,18 @@ nsFtpState::S_list() {
|
||||||
FTP_STATE
|
FTP_STATE
|
||||||
nsFtpState::R_list() {
|
nsFtpState::R_list() {
|
||||||
if (mResponseCode/100 == 1) {
|
if (mResponseCode/100 == 1) {
|
||||||
|
mRlist1xxReceived = true;
|
||||||
|
|
||||||
// OK, time to start reading from the data connection.
|
// OK, time to start reading from the data connection.
|
||||||
if (mDataStream && HasPendingCallback())
|
if (mDataStream && HasPendingCallback())
|
||||||
mDataStream->AsyncWait(this, 0, 0, CallbackTarget());
|
mDataStream->AsyncWait(this, 0, 0, CallbackTarget());
|
||||||
return FTP_READ_BUF;
|
return FTP_READ_BUF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mResponseCode/100 == 2) {
|
if (mResponseCode/100 == 2 && mRlist1xxReceived) {
|
||||||
//(DONE)
|
//(DONE)
|
||||||
mNextState = FTP_COMPLETE;
|
mNextState = FTP_COMPLETE;
|
||||||
|
mRlist1xxReceived = false;
|
||||||
return FTP_COMPLETE;
|
return FTP_COMPLETE;
|
||||||
}
|
}
|
||||||
return FTP_ERROR;
|
return FTP_ERROR;
|
||||||
|
@ -1181,13 +1187,16 @@ nsFtpState::S_retr() {
|
||||||
|
|
||||||
FTP_STATE
|
FTP_STATE
|
||||||
nsFtpState::R_retr() {
|
nsFtpState::R_retr() {
|
||||||
if (mResponseCode/100 == 2) {
|
if (mResponseCode/100 == 2 && mRretr1xxReceived) {
|
||||||
//(DONE)
|
//(DONE)
|
||||||
mNextState = FTP_COMPLETE;
|
mNextState = FTP_COMPLETE;
|
||||||
|
mRretr1xxReceived = false;
|
||||||
return FTP_COMPLETE;
|
return FTP_COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mResponseCode/100 == 1) {
|
if (mResponseCode/100 == 1) {
|
||||||
|
mRretr1xxReceived = true;
|
||||||
|
|
||||||
if (mDataStream && HasPendingCallback())
|
if (mDataStream && HasPendingCallback())
|
||||||
mDataStream->AsyncWait(this, 0, 0, CallbackTarget());
|
mDataStream->AsyncWait(this, 0, 0, CallbackTarget());
|
||||||
return FTP_READ_BUF;
|
return FTP_READ_BUF;
|
||||||
|
@ -1262,7 +1271,7 @@ nsFtpState::S_stor() {
|
||||||
|
|
||||||
FTP_STATE
|
FTP_STATE
|
||||||
nsFtpState::R_stor() {
|
nsFtpState::R_stor() {
|
||||||
if (mResponseCode/100 == 2) {
|
if (mResponseCode/100 == 2 && mRstor1xxReceived) {
|
||||||
//(DONE)
|
//(DONE)
|
||||||
mNextState = FTP_COMPLETE;
|
mNextState = FTP_COMPLETE;
|
||||||
mStorReplyReceived = true;
|
mStorReplyReceived = true;
|
||||||
|
@ -1270,11 +1279,12 @@ nsFtpState::R_stor() {
|
||||||
// Call Close() if it was not called in nsFtpState::OnStoprequest()
|
// Call Close() if it was not called in nsFtpState::OnStoprequest()
|
||||||
if (!mUploadRequest && !IsClosed())
|
if (!mUploadRequest && !IsClosed())
|
||||||
Close();
|
Close();
|
||||||
|
mRstor1xxReceived = false;
|
||||||
return FTP_COMPLETE;
|
return FTP_COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mResponseCode/100 == 1) {
|
if (mResponseCode/100 == 1) {
|
||||||
|
mRstor1xxReceived = true;
|
||||||
LOG(("FTP:(%x) writing on DT\n", this));
|
LOG(("FTP:(%x) writing on DT\n", this));
|
||||||
return FTP_READ_BUF;
|
return FTP_READ_BUF;
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,6 +180,12 @@ private:
|
||||||
bool mRetryPass; // retrying the password
|
bool mRetryPass; // retrying the password
|
||||||
bool mStorReplyReceived; // FALSE if waiting for STOR
|
bool mStorReplyReceived; // FALSE if waiting for STOR
|
||||||
// completion status from server
|
// completion status from server
|
||||||
|
bool mRlist1xxReceived; // TRUE if the server has sent a
|
||||||
|
// LIST 1xx response.
|
||||||
|
bool mRstor1xxReceived; // TRUE if the server has sent a
|
||||||
|
// STOR 1xx response.
|
||||||
|
bool mRretr1xxReceived; // TRUE if the server has sent a
|
||||||
|
// RETR 1xx response.
|
||||||
nsresult mInternalError; // represents internal state errors
|
nsresult mInternalError; // represents internal state errors
|
||||||
bool mReconnectAndLoginAgain;
|
bool mReconnectAndLoginAgain;
|
||||||
bool mCacheConnection;
|
bool mCacheConnection;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user