Backing out recent ftp change to know state. r+sr=darin, b=212439

git-svn-id: svn://10.0.0.236/trunk@144792 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%meer.net
2003-07-13 06:38:26 +00:00
parent 27d79cae4e
commit e4cf44b11b
3 changed files with 233 additions and 155 deletions

View File

@@ -411,8 +411,6 @@ nsFTPChannel::GetContentType(nsACString &aContentType)
NS_IMETHODIMP
nsFTPChannel::SetContentType(const nsACString &aContentType)
{
// If someone gives us a type hint we should just use that type instead of
// doing our guessing. So we don't care when this is being called.
nsAutoLock lock(mLock);
NS_ParseContentType(aContentType, mContentType, mContentCharset);
return NS_OK;
@@ -428,8 +426,6 @@ nsFTPChannel::GetContentCharset(nsACString &aContentCharset)
NS_IMETHODIMP
nsFTPChannel::SetContentCharset(const nsACString &aContentCharset)
{
// If someone gives us a charset hint we should just use that charset.
// So we don't care when this is being called.
mContentCharset = aContentCharset;
return NS_OK;
}
@@ -630,7 +626,7 @@ nsFTPChannel::OnStopRequest(nsIRequest *request, nsISupports* aContext,
if (NS_SUCCEEDED(mStatus)) {
(void) mCacheEntry->SetExpirationTime( NowInSeconds() + 900 ); // valid for 15 minutes.
(void) mCacheEntry->MarkValid();
}
}
else {
(void) mCacheEntry->Doom();
}

View File

@@ -541,7 +541,7 @@ nsFtpState::OnStartRequest(nsIRequest *request, nsISupports *aContext)
{
#if defined(PR_LOGGING)
nsCAutoString spec;
(void)mURI->GetAsciiSpec(spec);
(void)mURL->GetAsciiSpec(spec);
PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) nsFtpState::OnStartRequest() (spec =%s)\n",
this, spec.get()));
@@ -579,7 +579,7 @@ nsFtpState::EstablishControlConnection()
PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) trying cached control\n", this));
nsFtpControlConnection* connection;
(void) gFtpHandler->RemoveConnection(mURI, &connection);
(void) gFtpHandler->RemoveConnection(mURL, &connection);
if (connection) {
mControlConnection = connection;
@@ -590,10 +590,10 @@ nsFtpState::EstablishControlConnection()
// read cached variables into us.
mServerType = mControlConnection->mServerType;
mPwd = mControlConnection->mPwd;
mPassword = mControlConnection->mPassword;
mPwd = mControlConnection->mPwd;
mTryingCachedControl = PR_TRUE;
// we're already connected to this server, skip login.
mState = FTP_S_PASV;
mResponseCode = 530; //assume the control connection was dropped.
@@ -619,7 +619,7 @@ nsFtpState::EstablishControlConnection()
mNextState = FTP_S_USER;
nsCAutoString host;
rv = mURI->GetAsciiHost(host);
rv = mURL->GetAsciiHost(host);
if (NS_FAILED(rv)) return rv;
mControlConnection = new nsFtpControlConnection(host.get(), mPort);
@@ -794,7 +794,6 @@ nsFtpState::Process()
mInternalError = NS_ERROR_FAILURE;
break;
// CWD
case FTP_S_CWD:
rv = S_cwd();
@@ -805,37 +804,19 @@ nsFtpState::Process()
MoveToNextState(FTP_R_CWD);
break;
case FTP_R_CWD:
mState = R_cwd();
case FTP_R_CWD:
mState = R_cwd();
if (FTP_ERROR == mState)
mInternalError = NS_ERROR_FTP_CWD;
break;
// PWD
case FTP_S_PWD:
rv = S_pwd();
if (NS_FAILED(rv))
mInternalError = NS_ERROR_FTP_PWD;
MoveToNextState(FTP_R_PWD);
break;
case FTP_R_PWD:
mState = R_pwd();
if (FTP_ERROR == mState)
mInternalError = NS_ERROR_FTP_PWD;
break;
// LIST
case FTP_S_LIST:
rv = S_list();
if (NS_FAILED(rv))
mInternalError = NS_ERROR_FTP_LIST;
mInternalError = NS_ERROR_FTP_CWD;
MoveToNextState(FTP_R_LIST);
break;
@@ -955,6 +936,23 @@ nsFtpState::Process()
break;
// PWD
case FTP_S_PWD:
rv = S_pwd();
if (NS_FAILED(rv))
mInternalError = NS_ERROR_FTP_PWD;
MoveToNextState(FTP_R_PWD);
break;
case FTP_R_PWD:
mState = R_pwd();
if (FTP_ERROR == mState)
mInternalError = NS_ERROR_FTP_PWD;
break;
default:
;
@@ -981,14 +979,11 @@ nsFtpState::S_user() {
usernameStr.Append("anonymous");
} else {
if (mUsername.IsEmpty()) {
if (!mAuthPrompter) {
NS_WARNING("No Auth Prompt.");
return NS_ERROR_NOT_INITIALIZED;
}
if (!mAuthPrompter) return NS_ERROR_NOT_INITIALIZED;
PRUnichar *user = nsnull, *passwd = nsnull;
PRBool retval;
nsCAutoString prePath;
rv = mURI->GetPrePath(prePath);
rv = mURL->GetPrePath(prePath);
if (NS_FAILED(rv)) return rv;
NS_ConvertUTF8toUCS2 prePathU(prePath);
@@ -1079,16 +1074,13 @@ nsFtpState::S_pass() {
}
} else {
if (mPassword.IsEmpty() || mRetryPass) {
if (!mAuthPrompter) {
NS_WARNING("No Auth Prompt.");
return NS_ERROR_NOT_INITIALIZED;
}
if (!mAuthPrompter) return NS_ERROR_NOT_INITIALIZED;
PRUnichar *passwd = nsnull;
PRBool retval;
nsCAutoString prePath;
rv = mURI->GetPrePath(prePath);
rv = mURL->GetPrePath(prePath);
if (NS_FAILED(rv)) return rv;
NS_ConvertUTF8toUCS2 prePathU(prePath);
@@ -1150,7 +1142,7 @@ nsFtpState::R_pass() {
nsCOMPtr<nsIPasswordManager> pm = do_GetService(NS_PASSWORDMANAGER_CONTRACTID);
if (pm) {
nsCAutoString prePath;
nsresult rv = mURI->GetPrePath(prePath);
nsresult rv = mURL->GetPrePath(prePath);
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get prepath");
if (NS_SUCCEEDED(rv)) {
pm->RemoveUser(prePath, NS_LITERAL_STRING(""));
@@ -1165,14 +1157,13 @@ nsFtpState::R_pass() {
return FTP_ERROR;
}
nsresult
nsFtpState::S_pwd() {
nsCString pwdStr("PWD" CRLF);
return SendFTPCommand(pwdStr);
}
FTP_STATE
FTP_STATE
nsFtpState::R_pwd() {
if (mResponseCode/100 != 2)
return FTP_ERROR;
@@ -1193,45 +1184,6 @@ nsFtpState::R_pwd() {
return FTP_S_TYPE;
}
nsresult
nsFtpState::S_cwd() {
nsCAutoString cwdStr(mPath);
if (cwdStr.IsEmpty() || cwdStr.First() != '/')
cwdStr.Insert(mPwd,0);
cwdStr.Insert("CWD ",0);
cwdStr.Append(CRLF);
return SendFTPCommand(cwdStr);
}
FTP_STATE
nsFtpState::R_cwd() {
if (mResponseCode/100 == 2) {
if (mAction == PUT)
return FTP_S_STOR;
return FTP_S_LIST;
}
return FTP_ERROR;
}
nsresult
nsFtpState::S_acct() {
nsCString acctString("ACCT noaccount" CRLF);
return SendFTPCommand(acctString);
}
FTP_STATE
nsFtpState::R_acct() {
if (mResponseCode/100 == 2)
return FTP_S_SYST;
else
return FTP_ERROR;
}
nsresult
nsFtpState::S_syst() {
nsCString systString("SYST" CRLF);
@@ -1263,10 +1215,38 @@ nsFtpState::R_syst() {
}
else
{
// All else fails, this is to be treated like a unix box.
mServerType = FTP_UNIX_TYPE;
}
NS_ASSERTION(0, "Server type list format unrecognized.");
// Guessing causes crashes.
// (Of course, the parsing code should be more robust...)
nsresult rv;
nsCOMPtr<nsIStringBundleService> bundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return FTP_ERROR;
nsCOMPtr<nsIStringBundle> bundle;
rv = bundleService->CreateBundle(NECKO_MSGS_URL,
getter_AddRefs(bundle));
if (NS_FAILED(rv)) return FTP_ERROR;
nsXPIDLString formatedString;
PRUnichar* ucs2Response = ToNewUnicode(mResponseMsg);
const PRUnichar *formatStrings[1] = { ucs2Response };
rv = bundle->FormatStringFromName(NS_LITERAL_STRING("UnsupportedFTPServer").get(),
formatStrings, 1,
getter_Copies(formatedString));
nsMemory::Free(ucs2Response);
if (NS_FAILED(rv)) return FTP_ERROR;
NS_ASSERTION(mPrompter, "no prompter!");
if (mPrompter)
(void) mPrompter->Alert(nsnull, formatedString.get());
// since we just alerted the user, clear mResponseMsg,
// which is displayed to the user.
mResponseMsg = "";
return FTP_ERROR;
}
return FTP_S_PWD;
}
@@ -1280,6 +1260,20 @@ nsFtpState::R_syst() {
return FTP_ERROR;
}
nsresult
nsFtpState::S_acct() {
nsCString acctString("ACCT noaccount" CRLF);
return SendFTPCommand(acctString);
}
FTP_STATE
nsFtpState::R_acct() {
if (mResponseCode/100 == 2)
return FTP_S_SYST;
else
return FTP_ERROR;
}
nsresult
nsFtpState::S_type() {
nsCString typeString("TYPE I" CRLF);
@@ -1295,17 +1289,45 @@ nsFtpState::R_type() {
}
nsresult
nsFtpState::S_size() {
nsCAutoString cmdString("SIZE ");
if (mPath.IsEmpty()) {
cmdString.Append("/");
}
nsFtpState::S_cwd() {
nsCAutoString cwdStr(mPath);
if (mServerType == FTP_VMS_TYPE)
ConvertDirspecToVMS(cwdStr);
else {
cmdString.Append(mPath);
if (cwdStr.IsEmpty() || cwdStr.First() != '/')
cwdStr.Insert(mPwd,0);
}
cmdString.Append(CRLF);
cwdStr.Insert("CWD ",0);
cwdStr.Append(CRLF);
return SendFTPCommand(cmdString);
return SendFTPCommand(cwdStr);
}
FTP_STATE
nsFtpState::R_cwd() {
if (mResponseCode/100 == 2) {
if (mAction == PUT)
return FTP_S_STOR;
return FTP_S_LIST;
}
return FTP_ERROR;
}
nsresult
nsFtpState::S_size() {
nsCAutoString sizeBuf(mPath);
if (mServerType == FTP_VMS_TYPE)
ConvertFilespecToVMS(sizeBuf);
else {
if (sizeBuf.IsEmpty() || sizeBuf.First() != '/')
sizeBuf.Insert(mPwd,0);
}
sizeBuf.Insert("SIZE ",0);
sizeBuf.Append(CRLF);
return SendFTPCommand(sizeBuf);
}
FTP_STATE
@@ -1321,15 +1343,17 @@ nsFtpState::R_size() {
nsresult
nsFtpState::S_mdtm() {
nsCAutoString cmdString("MDTM ");
if (mPath.IsEmpty()) {
cmdString.Append("/");
}
nsCAutoString mdtmBuf(mPath);
if (mServerType == FTP_VMS_TYPE)
ConvertFilespecToVMS(mdtmBuf);
else {
cmdString.Append(mPath);
if (mdtmBuf.IsEmpty() || mdtmBuf.First() != '/')
mdtmBuf.Insert(mPwd,0);
}
cmdString.Append(CRLF);
return SendFTPCommand(cmdString);
mdtmBuf.Insert("MDTM ",0);
mdtmBuf.Append(CRLF);
return SendFTPCommand(mdtmBuf);
}
FTP_STATE
@@ -1488,20 +1512,20 @@ nsFtpState::R_list() {
nsresult
nsFtpState::S_retr() {
nsresult rv = NS_OK;
nsCAutoString cmdString("RETR ");
if (mPath.IsEmpty()) {
cmdString.Append("/");
}
nsCAutoString retrStr(mPath);
if (mServerType == FTP_VMS_TYPE)
ConvertFilespecToVMS(retrStr);
else {
cmdString.Append(mPath);
if (retrStr.IsEmpty() || retrStr.First() != '/')
retrStr.Insert(mPwd,0);
}
cmdString.Append(CRLF);
retrStr.Insert("RETR ",0);
retrStr.Append(CRLF);
if (!mDRequestForwarder)
return NS_ERROR_FAILURE;
rv = SendFTPCommand(cmdString);
rv = SendFTPCommand(retrStr);
return rv;
}
@@ -1530,10 +1554,16 @@ nsFtpState::R_retr() {
}
// These error codes are related to problems with the connection.
// If we encounter any at this point, do not try again and abort.
// If we encounter any at this point, do not try CWD and abort.
if (mResponseCode == 421 || mResponseCode == 425 || mResponseCode == 426)
return FTP_ERROR;
if (mServerType == FTP_VMS_TYPE) {
// We don't handle VMS directory listings yet. If we continue, we get
// scs->AsyncConvertData failed (rv=80004005)
return FTP_ERROR;
}
if (mResponseCode/100 == 5) {
mRETRFailed = PR_TRUE;
mDRequestForwarder->SetRetrying(PR_TRUE);
@@ -1578,17 +1608,28 @@ nsFtpState::S_stor() {
NS_ASSERTION(mAction == PUT, "Wrong state to be here");
nsCAutoString cmdString("STOR ");
nsCAutoString storStr;
nsresult rv;
nsCOMPtr<nsIURL> aURL(do_QueryInterface(mURL, &rv));
if (NS_FAILED(rv)) return rv;
if (mPath.IsEmpty()) {
NS_WARNING("Sending STOR without a path");
rv = aURL->GetFilePath(storStr);
if (NS_FAILED(rv)) return rv;
NS_ASSERTION(!storStr.IsEmpty(), "What does it mean to store a empty path");
if (storStr.First() == '/')
{
// kill the first slash since we want to be relative to CWD.
storStr.Cut(0,1);
}
else {
cmdString.Append(mPath);
if (mServerType == FTP_VMS_TYPE) {
ConvertFilespecToVMS(storStr);
}
cmdString.Append(CRLF);
NS_UnescapeURL(storStr);
storStr.Insert("STOR ",0);
storStr.Append(CRLF);
return SendFTPCommand(cmdString);
return SendFTPCommand(storStr);
}
FTP_STATE
@@ -1874,10 +1915,8 @@ nsFtpState::R_pasv() {
}
}
if (mRETRFailed || mPath.IsEmpty() || mPath.Last() == '/') {
if (mRETRFailed)
return FTP_S_CWD;
}
return FTP_S_SIZE;
}
@@ -1888,7 +1927,7 @@ nsFtpState::R_pasv() {
NS_IMETHODIMP
nsFtpState::GetName(nsACString &result)
{
return mURI->GetSpec(result);
return mURL->GetSpec(result);
}
NS_IMETHODIMP
@@ -1908,7 +1947,7 @@ nsFtpState::IsPending(PRBool *result)
}
NS_IMETHODIMP
nsFtpState::GetStatus(nsresult *status)
nsFtpState::GetStatus(nsresult *status)
{
*status = mInternalError;
return NS_OK;
@@ -1920,6 +1959,7 @@ nsFtpState::Cancel(nsresult status)
NS_ASSERTION(NS_FAILED(status), "shouldn't cancel with a success code");
PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) nsFtpState::Cancel() rv=%x\n", this, status));
// we should try to recover the control connection....
if (NS_SUCCEEDED(mControlStatus))
mControlStatus = status;
@@ -2132,7 +2172,7 @@ nsFtpState::Init(nsIFTPChannel* aChannel,
mChannel = aChannel; // a straight com ptr to the channel
rv = aChannel->GetURI(getter_AddRefs(mURI));
rv = aChannel->GetURI(getter_AddRefs(mURL));
if (NS_FAILED(rv)) return rv;
if (mCacheEntry) {
@@ -2149,7 +2189,7 @@ nsFtpState::Init(nsIFTPChannel* aChannel,
NS_ADDREF(mDRequestForwarder);
rv = mDRequestForwarder->Init(mChannel);
nsXPIDLCString serverType;
(void) mCacheEntry->GetMetaDataElement("servertype", getter_Copies(serverType));
nsCAutoString serverNum(serverType.get());
@@ -2182,11 +2222,11 @@ nsFtpState::Init(nsIFTPChannel* aChannel,
}
nsCAutoString path;
nsCOMPtr<nsIURL> aURL(do_QueryInterface(mURI));
nsCOMPtr<nsIURL> aURL(do_QueryInterface(mURL));
if (aURL)
rv = aURL->GetFilePath(path);
else
rv = mURI->GetPath(path);
rv = mURL->GetPath(path);
if (NS_FAILED(rv)) return rv;
// Skip leading slash
@@ -2205,7 +2245,7 @@ nsFtpState::Init(nsIFTPChannel* aChannel,
// pull any username and/or password out of the uri
nsCAutoString uname;
rv = mURI->GetUsername(uname);
rv = mURL->GetUsername(uname);
if (NS_FAILED(rv))
return rv;
@@ -2219,7 +2259,7 @@ nsFtpState::Init(nsIFTPChannel* aChannel,
}
nsCAutoString password;
rv = mURI->GetPassword(password);
rv = mURL->GetPassword(password);
if (NS_FAILED(rv))
return rv;
@@ -2232,7 +2272,7 @@ nsFtpState::Init(nsIFTPChannel* aChannel,
// setup the connection cache key
PRInt32 port;
rv = mURI->GetPort(&port);
rv = mURL->GetPort(&port);
if (NS_FAILED(rv)) return rv;
if (port > 0)
@@ -2296,26 +2336,26 @@ nsFtpState::KillControlConnection() {
// kill the reference to ourselves in the control connection.
(void) mControlConnection->SetStreamListener(nsnull);
#ifdef FTP_CACHE_CONTROL_CONNECTION
if (NS_SUCCEEDED(mInternalError) &&
if (FTP_CACHE_CONTROL_CONNECTION &&
NS_SUCCEEDED(mInternalError) &&
NS_SUCCEEDED(mControlStatus) &&
mControlConnection->IsAlive()) {
PR_LOG(gFTPLog, PR_LOG_ALWAYS, ("(%x) nsFtpState caching control connection", this));
// Store connection persistant data
mControlConnection->mServerType = mServerType;
mControlConnection->mServerType = mServerType;
mControlConnection->mPassword = mPassword;
mControlConnection->mPwd = mPwd;
nsresult rv = gFtpHandler->InsertConnection(mURI, mControlConnection);
nsresult rv = gFtpHandler->InsertConnection(mURL, mControlConnection);
// Can't cache it? Kill it then.
mControlConnection->Disconnect(rv);
}
else
#endif
mControlConnection->Disconnect(NS_BINDING_ABORTED);
NS_RELEASE(mControlConnection);
return;
}
@@ -2331,6 +2371,7 @@ nsFtpState::StopProcessing() {
{
// check to see if the control status is bad.
// web shell wont throw an alert. we better:
NS_ASSERTION(mPrompter, "no prompter!");
if (mPrompter)
(void) mPrompter->Alert(nsnull, NS_ConvertASCIItoUCS2(mResponseMsg).get());
@@ -2351,6 +2392,7 @@ nsFtpState::StopProcessing() {
else
{
// The forwarding object was never created which means that we never sent our notifications.
nsCOMPtr<nsIRequestObserver> asyncObserver = do_QueryInterface(mChannel);
nsCOMPtr<nsIRequestObserver> arg = do_QueryInterface(mChannel);
@@ -2361,6 +2403,8 @@ nsFtpState::StopProcessing() {
(void) asyncObserver->OnStartRequest(this, nsnull);
(void) asyncObserver->OnStopRequest(this, nsnull, broadcastErrorCode);
}
}
// Clean up the event loop
@@ -2416,13 +2460,13 @@ nsFtpState::BuildStreamConverter(nsIStreamListener** convertStreamListener)
rv = scs->AsyncConvertData(NS_LITERAL_STRING(APPLICATION_HTTP_INDEX_FORMAT).get(),
NS_LITERAL_STRING(TEXT_HTML).get(),
listener,
mURI,
mURL,
getter_AddRefs(tmpListener));
if (NS_FAILED(rv)) break;
rv = scs->AsyncConvertData(fromStr.get(),
NS_LITERAL_STRING(APPLICATION_HTTP_INDEX_FORMAT).get(),
tmpListener,
mURI,
mURL,
getter_AddRefs(converterListener));
}
@@ -2431,7 +2475,7 @@ nsFtpState::BuildStreamConverter(nsIStreamListener** convertStreamListener)
rv = scs->AsyncConvertData(fromStr.get(),
NS_LITERAL_STRING(APPLICATION_HTTP_INDEX_FORMAT).get(),
listener,
mURI,
mURL,
getter_AddRefs(converterListener));
break;
}
@@ -2490,3 +2534,32 @@ nsFtpState::SendFTPCommand(nsCString& command)
}
return NS_ERROR_FAILURE;
}
// Convert a relative unix-style filespec to VMS format
void
nsFtpState::ConvertFilespecToVMS(nsCString& fileSpec)
{
PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) ConvertFilespecToVMS %s\n", this, fileSpec.get()));
if (fileSpec.IsEmpty()) {
fileSpec.Insert("[]",0);
}
else {
PRInt32 endDir = fileSpec.RFindChar('/');
if (endDir > -1) {
fileSpec.Cut(endDir,1);
fileSpec.Insert(']',endDir);
fileSpec.Insert("[.",0);
fileSpec.ReplaceChar('/','.');
}
}
}
// Convert a relative unix-style dirspec to VMS format
void
nsFtpState::ConvertDirspecToVMS(nsCString& dirSpec)
{
PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) ConvertDirspecToVMS %s\n", this, dirSpec.get()));
dirSpec.ReplaceChar('/','.');
dirSpec.Insert("[.",0);
dirSpec.Append(']');
}

View File

@@ -90,7 +90,6 @@ typedef enum _FTP_STATE {
FTP_S_ACCT, FTP_R_ACCT,
FTP_S_TYPE, FTP_R_TYPE,
FTP_S_CWD, FTP_R_CWD,
FTP_S_PWD, FTP_R_PWD,
FTP_S_SIZE, FTP_R_SIZE,
FTP_S_MDTM, FTP_R_MDTM,
FTP_S_REST, FTP_R_REST,
@@ -98,6 +97,7 @@ typedef enum _FTP_STATE {
FTP_S_STOR, FTP_R_STOR,
FTP_S_LIST, FTP_R_LIST,
FTP_S_PASV, FTP_R_PASV,
FTP_S_PWD, FTP_R_PWD
} FTP_STATE;
// higher level ftp actions
@@ -141,12 +141,11 @@ private:
// BEGIN: STATE METHODS
nsresult S_user(); FTP_STATE R_user();
nsresult S_pass(); FTP_STATE R_pass();
nsresult S_acct(); FTP_STATE R_acct();
nsresult S_syst(); FTP_STATE R_syst();
nsresult S_acct(); FTP_STATE R_acct();
nsresult S_type(); FTP_STATE R_type();
nsresult S_cwd(); FTP_STATE R_cwd();
nsresult S_pwd(); FTP_STATE R_pwd();
nsresult S_size(); FTP_STATE R_size();
nsresult S_mdtm(); FTP_STATE R_mdtm();
@@ -156,6 +155,7 @@ private:
nsresult S_retr(); FTP_STATE R_retr();
nsresult S_stor(); FTP_STATE R_stor();
nsresult S_pasv(); FTP_STATE R_pasv();
nsresult S_pwd(); FTP_STATE R_pwd();
// END: STATE METHODS
///////////////////////////////////
@@ -167,6 +167,8 @@ private:
nsresult StopProcessing();
nsresult EstablishControlConnection();
nsresult SendFTPCommand(nsCString& command);
void ConvertFilespecToVMS(nsCString& fileSpec);
void ConvertDirspecToVMS(nsCString& fileSpec);
nsresult BuildStreamConverter(nsIStreamListener** convertStreamListener);
nsresult SetContentType();
PRBool CanReadEntry();
@@ -197,6 +199,10 @@ private:
nsCOMPtr<nsIFTPChannel> mChannel; // our owning FTP channel we pass through our events
nsCOMPtr<nsIProxyInfo> mProxyInfo;
// ****** connection cache vars
PRInt32 mServerType; // What kind of server are we talking to
PRPackedBool mList; // Use LIST instead of NLST
// ****** protocol interpretation related state vars
nsString mUsername; // username
nsString mPassword; // password
@@ -204,23 +210,26 @@ private:
PRPackedBool mAnonymous; // try connecting anonymous (default)
PRPackedBool mRetryPass; // retrying the password
nsresult mInternalError; // represents internal state errors
PRInt32 mServerType; // What kind of server are we talking to
// ****** URI vars
nsCOMPtr<nsIURI> mURI; // the uri we're connecting to
nsCOMPtr<nsIURI> mURL; // the uri we're connecting to
PRInt32 mPort; // the port to connect to
nsString mFilename; // url filename (if any)
nsCString mPath; // the url's path
nsCString mPwd; // login Path
// ****** other vars
nsCOMPtr<nsIInputStream> mWriteStream; // This stream is written to the server.
PRUint32 mWriteCount;
PRUint8 mSuspendCount;// number of times we've been suspended.
PRPackedBool mIPv6Checked;
nsCOMPtr<nsIPrompt> mPrompter;
nsCOMPtr<nsIFTPEventSink> mFTPEventSink;
nsCOMPtr<nsIAuthPrompt> mAuthPrompter;
PRUint32 mListFormat;
PRUint8 mSuspendCount;// number of times we've been suspended.
PRUint32 mBufferSegmentSize;
PRUint32 mBufferMaxSize;
PRLock *mLock;
nsCOMPtr<nsIInputStream> mWriteStream; // This stream is written to the server.
PRUint32 mWriteCount;
PRPackedBool mIPv6Checked;
nsCOMPtr<nsIPrompt> mPrompter;
nsCOMPtr<nsIFTPEventSink> mFTPEventSink;
nsCOMPtr<nsIAuthPrompt> mAuthPrompter;
PRUint32 mListFormat;
static PRUint32 mSessionStartTime;