зеркало из https://github.com/mozilla/pjs.git
Fixes 77032, 65270, 71556, 76274, 61290, 47689. Also makes Suspend/Resume work. r=neeti@netscape.com, sr=darin@netscape.com
This commit is contained in:
Родитель
3b83b9a8ad
Коммит
aa1eedbc15
|
@ -31,20 +31,11 @@
|
|||
#define NS_ERROR_FTP_LOGIN \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 21)
|
||||
|
||||
#define NS_ERROR_FTP_MODE \
|
||||
#define NS_ERROR_FTP_CWD \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 22)
|
||||
|
||||
#define NS_ERROR_FTP_CWD \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 23)
|
||||
|
||||
#define NS_ERROR_FTP_PASV \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 24)
|
||||
|
||||
#define NS_ERROR_FTP_DEL_DIR \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 25)
|
||||
|
||||
#define NS_ERROR_FTP_MKDIR \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 26)
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 23)
|
||||
|
||||
/**
|
||||
* Status nsresult codes: used with nsINotification objects
|
||||
|
|
|
@ -461,7 +461,11 @@ nsFTPChannel::OnStatus(nsIRequest *request, nsISupports *aContext,
|
|||
NS_IMETHODIMP
|
||||
nsFTPChannel::OnProgress(nsIRequest *request, nsISupports* aContext,
|
||||
PRUint32 aProgress, PRUint32 aProgressMax) {
|
||||
return mEventSink ? mEventSink->OnProgress(this, mUserContext, aProgress, (PRUint32) mContentLength) : NS_OK;
|
||||
if (!mEventSink)
|
||||
return NS_OK;
|
||||
|
||||
return mEventSink->OnProgress(this, mUserContext,
|
||||
aProgress, (PRUint32) mContentLength);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,16 +46,10 @@
|
|||
#define FTP_COMMAND_CHANNEL_SEG_SIZE 64
|
||||
#define FTP_COMMAND_CHANNEL_MAX_SIZE 512
|
||||
|
||||
#define FTP_DATA_CHANNEL_SEG_SIZE (32*1024)
|
||||
#define FTP_DATA_CHANNEL_MAX_SIZE (256*1024)
|
||||
|
||||
#define NS_FTP_BUFFER_READ_SIZE (8*1024)
|
||||
#define NS_FTP_BUFFER_WRITE_SIZE (8*1024)
|
||||
#define FTP_DATA_CHANNEL_SEG_SIZE (64*1024)
|
||||
#define FTP_DATA_CHANNEL_MAX_SIZE (512*1024)
|
||||
|
||||
#define FTP_CACHE_CONTROL_CONNECTION 1
|
||||
//#define FTP_SIMULATE_DROPPED_CONTROL_CONNECTION
|
||||
|
||||
|
||||
|
||||
class nsFTPChannel : public nsIFTPChannel,
|
||||
public nsIProxy,
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -72,27 +72,18 @@ typedef enum _FTP_STATE {
|
|||
FTP_S_PASS, FTP_R_PASS,
|
||||
FTP_S_SYST, FTP_R_SYST,
|
||||
FTP_S_ACCT, FTP_R_ACCT,
|
||||
FTP_S_PWD , FTP_R_PWD ,
|
||||
FTP_S_DEL_FILE, FTP_R_DEL_FILE,
|
||||
FTP_S_DEL_DIR , FTP_R_DEL_DIR ,
|
||||
FTP_S_MKDIR, FTP_R_MKDIR,
|
||||
FTP_S_MODE, FTP_R_MODE,
|
||||
FTP_S_TYPE, FTP_R_TYPE,
|
||||
FTP_S_CWD, FTP_R_CWD,
|
||||
FTP_S_SIZE, FTP_R_SIZE,
|
||||
FTP_S_REST, FTP_R_REST,
|
||||
FTP_S_RETR, FTP_R_RETR,
|
||||
FTP_S_STOR, FTP_R_STOR,
|
||||
FTP_S_MDTM, FTP_R_MDTM,
|
||||
FTP_S_LIST, FTP_R_LIST,
|
||||
FTP_S_TYPE, FTP_R_TYPE,
|
||||
|
||||
///////////////////////
|
||||
//// Data channel connection setup states
|
||||
FTP_S_PASV,
|
||||
FTP_R_PASV
|
||||
FTP_S_PASV, FTP_R_PASV
|
||||
} FTP_STATE;
|
||||
|
||||
// higher level ftp actions
|
||||
typedef enum _FTP_ACTION { GET, PUT, MKDIR, DEL} FTP_ACTION;
|
||||
typedef enum _FTP_ACTION {GET, PUT} FTP_ACTION;
|
||||
|
||||
class DataRequestForwarder;
|
||||
|
||||
|
@ -124,27 +115,22 @@ private:
|
|||
nsresult S_syst(); FTP_STATE R_syst();
|
||||
nsresult S_acct(); FTP_STATE R_acct();
|
||||
|
||||
nsresult S_pwd(); FTP_STATE R_pwd();
|
||||
nsresult S_mode(); FTP_STATE R_mode();
|
||||
nsresult S_type(); FTP_STATE R_type();
|
||||
nsresult S_cwd(); FTP_STATE R_cwd();
|
||||
|
||||
nsresult S_size(); FTP_STATE R_size();
|
||||
nsresult S_mdtm(); FTP_STATE R_mdtm();
|
||||
nsresult S_list(); FTP_STATE R_list();
|
||||
|
||||
nsresult S_rest(); FTP_STATE R_rest();
|
||||
nsresult S_retr(); FTP_STATE R_retr();
|
||||
nsresult S_stor(); FTP_STATE R_stor();
|
||||
nsresult S_pasv(); FTP_STATE R_pasv();
|
||||
nsresult S_del_file(); FTP_STATE R_del_file();
|
||||
nsresult S_del_dir(); FTP_STATE R_del_dir();
|
||||
|
||||
nsresult S_mkdir(); FTP_STATE R_mkdir();
|
||||
// END: STATE METHODS
|
||||
///////////////////////////////////
|
||||
|
||||
// internal methods
|
||||
FTP_STATE FindActionState(void);
|
||||
void SetDirMIMEType(nsString& aString);
|
||||
void MoveToNextState(FTP_STATE nextState);
|
||||
nsresult Process();
|
||||
|
||||
|
||||
|
@ -169,10 +155,11 @@ private:
|
|||
nsCAutoString mResponseMsg; // the last command response text
|
||||
|
||||
// ****** channel/transport/stream vars
|
||||
nsFtpControlConnection* mControlConnection;// cacheable control connection (owns mCPipe)
|
||||
nsFtpControlConnection* mControlConnection; // cacheable control connection (owns mCPipe)
|
||||
PRPackedBool mReceivedControlData;
|
||||
PRPackedBool mTryingCachedControl; // retrying the password
|
||||
PRPackedBool mWaitingForDConn; // Are we wait for a data connection
|
||||
nsCOMPtr<nsITransport> mDPipe; // the data transport
|
||||
PRPackedBool mWaitingForDConn; // Are we wait for a data connection
|
||||
nsCOMPtr<nsITransport> mDPipe; // the data transport
|
||||
nsCOMPtr<nsIRequest> mDPipeRequest;
|
||||
DataRequestForwarder* mDRequestForwarder;
|
||||
|
||||
|
@ -183,8 +170,6 @@ private:
|
|||
// ****** connection cache vars
|
||||
PRInt32 mServerType; // What kind of server are we talking to
|
||||
PRPackedBool mList; // Use LIST instead of NLST
|
||||
nsCAutoString mCwd; // Our current working dir.
|
||||
nsCAutoString mCwdAttempt; // The dir we're trying to get into.
|
||||
|
||||
// ****** protocol interpretation related state vars
|
||||
nsAutoString mUsername; // username
|
||||
|
@ -198,7 +183,6 @@ private:
|
|||
nsCOMPtr<nsIURI> mURL; // the uri we're connecting to
|
||||
PRInt32 mPort; // the port to connect to
|
||||
nsAutoString mFilename; // url filename (if any)
|
||||
PRTime mLastModified;// last modified time for file
|
||||
nsXPIDLCString mPath; // the url's path
|
||||
|
||||
// ****** other vars
|
||||
|
|
|
@ -117,7 +117,7 @@ nsFtpControlConnection::nsFtpControlConnection(nsITransport* socketTransport)
|
|||
NS_INIT_REFCNT();
|
||||
PR_LOG(gFTPLog, PR_LOG_ALWAYS, ("(%x) nsFtpControlConnection created", this));
|
||||
mServerType = 0;
|
||||
mConnected = mList = PR_FALSE;
|
||||
mConnected = PR_FALSE;
|
||||
|
||||
mLock = PR_NewLock();
|
||||
NS_ASSERTION(mLock, "null lock");
|
||||
|
|
|
@ -55,8 +55,6 @@ public:
|
|||
nsresult SetStreamListener(nsIStreamListener *aListener);
|
||||
|
||||
PRUint32 mServerType; // what kind of server is it.
|
||||
nsCAutoString mCwd; // what dir are we in
|
||||
PRBool mList; // are we sending LIST or NLST
|
||||
nsAutoString mPassword;
|
||||
PRInt32 mSuspendedWrite;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче