Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
nsFtpState Class Reference

#include <nsFtpConnectionThread.h>

Inheritance diagram for nsFtpState:
Inheritance graph
[legend]
Collaboration diagram for nsFtpState:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSIREQUEST 
nsFtpState ()
virtual ~nsFtpState ()
nsresult Init (nsFTPChannel *aChannel, nsICacheEntryDescriptor *cacheEntry, nsIProxyInfo *proxyInfo, PRUint64 startPos, const nsACString &entity)
nsresult SetWriteStream (nsIInputStream *aInStream)
nsresult GetEntityID (nsACString &aEntityID)
nsresult Connect ()
void DataConnectionEstablished ()
void DataConnectionComplete ()
void onDataAvailable (in nsIRequest aRequest, in nsISupports aContext, in nsIInputStream aInputStream, in unsigned long aOffset, in unsigned long aCount)
 Called when the next chunk of data (corresponding to the request) may be read without blocking the calling thread.
void onStartRequest (in nsIRequest aRequest, in nsISupports aContext)
 Called to signify the beginning of an asynchronous request.
void onStopRequest (in nsIRequest aRequest, in nsISupports aContext, in nsresult aStatusCode)
 Called to signify the end of an asynchronous request.
boolean isPending ()
 Indicates whether the request is pending.
void cancel (in nsresult aStatus)
 Cancels the current request.
void suspend ()
 Suspends the current request.
void resume ()
 Resumes the current request.

Public Attributes

readonly attribute AUTF8String name
 The name of the request.
readonly attribute nsresult status
 The error status associated with the request.
attribute nsILoadGroup loadGroup
 The load group of this request.
attribute nsLoadFlags loadFlags
 The load flags of this request.
const unsigned long LOAD_NORMAL = 0
 No special load flags:
const unsigned long LOAD_BACKGROUND = 1 << 0
 Don't deliver status notifications to the nsIProgressEventSink, or keep this load from completing the nsILoadGroup it may belong to.
const unsigned long INHIBIT_CACHING = 1 << 7
 This flag prevents caching of any kind.
const unsigned long INHIBIT_PERSISTENT_CACHING = 1 << 8
 This flag prevents caching on disk (or other persistent media), which may be needed to preserve privacy.
const unsigned long LOAD_BYPASS_CACHE = 1 << 9
 Force an end-to-end download of content data from the origin server.
const unsigned long LOAD_FROM_CACHE = 1 << 10
 Load from the cache, bypassing protocol specific validation logic.
const unsigned long VALIDATE_ALWAYS = 1 << 11
 The following flags control the frequency of cached content validation when neither LOAD_BYPASS_CACHE or LOAD_FROM_CACHE are set.
const unsigned long VALIDATE_NEVER = 1 << 12
const unsigned long VALIDATE_ONCE_PER_SESSION = 1 << 13

Private Member Functions

nsresult S_user ()
FTP_STATE R_user ()
nsresult S_pass ()
FTP_STATE R_pass ()
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_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_pwd ()
FTP_STATE R_pwd ()
void MoveToNextState (FTP_STATE nextState)
nsresult Process ()
void KillControlConnection ()
nsresult StopProcessing ()
nsresult EstablishControlConnection ()
nsresult SendFTPCommand (nsCString &command)
void ConvertFilespecToVMS (nsCString &fileSpec)
void ConvertDirspecToVMS (nsCString &fileSpec)
void ConvertDirspecFromVMS (nsCString &fileSpec)
nsresult BuildStreamConverter (nsIStreamListener **convertStreamListener)
nsresult SetContentType ()
PRBool CanReadEntry ()

Private Attributes

FTP_STATE mState
FTP_STATE mNextState
PRPackedBool mKeepRunning
PRInt32 mResponseCode
nsCAutoString mResponseMsg
nsFtpControlConnectionmControlConnection
PRPackedBool mReceivedControlData
PRPackedBool mTryingCachedControl
PRPackedBool mWaitingForDConn
PRPackedBool mRETRFailed
nsCOMPtr< nsISocketTransportmDPipe
nsCOMPtr< nsIRequestmDPipeRequest
DataRequestForwardermDRequestForwarder
PRUint64 mFileSize
nsCString mModTime
nsRefPtr< nsFTPChannelmChannel
nsCOMPtr< nsIProxyInfomProxyInfo
PRInt32 mServerType
PRPackedBool mList
nsString mUsername
nsString mPassword
FTP_ACTION mAction
PRPackedBool mAnonymous
PRPackedBool mRetryPass
nsresult mInternalError
nsCOMPtr< nsIURImURL
PRInt32 mPort
nsString mFilename
nsCString mPath
nsCString mPwd
PRUint8 mSuspendCount
PRUint32 mBufferSegmentSize
PRUint32 mBufferMaxSize
PRLockmLock
nsCOMPtr< nsIInputStreammWriteStream
PRUint32 mWriteCount
PRPackedBool mAddressChecked
PRPackedBool mServerIsIPv6
char mServerAddress [64]
nsresult mControlStatus
nsCAutoString mControlReadCarryOverBuf
nsCOMPtr< nsICacheEntryDescriptormCacheEntry
nsUint64 mStartPos
nsCString mSuppliedEntityID
nsCString mEntityID

Static Private Attributes

static PRUint32 mSessionStartTime = NowInSeconds()

Detailed Description

Definition at line 110 of file nsFtpConnectionThread.h.


Constructor & Destructor Documentation

NS_DECL_ISUPPORTS NS_DECL_NSISTREAMLISTENER NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSIREQUEST nsFtpState::nsFtpState ( )
nsFtpState::~nsFtpState ( ) [virtual]

Definition at line 441 of file nsFtpConnectionThread.cpp.

{
    LOG_ALWAYS(("(%x) nsFtpState destroyed", this));
    
    NS_IF_RELEASE(mDRequestForwarder);

    // release reference to handler
    nsFtpProtocolHandler *handler = gFtpHandler;
    NS_RELEASE(handler);
}

Member Function Documentation

nsresult nsFtpState::BuildStreamConverter ( nsIStreamListener **  convertStreamListener) [private]

Definition at line 2444 of file nsFtpConnectionThread.cpp.

{
    nsresult rv;
    // setup a listener to push the data into. This listener sits inbetween the
    // unconverted data of fromType, and the final listener in the chain (in this case
    // the mListener).
    nsCOMPtr<nsIStreamListener> converterListener;

    nsCOMPtr<nsIStreamConverterService> scs = 
             do_GetService(kStreamConverterServiceCID, &rv);

    if (NS_FAILED(rv)) 
        return rv;

    rv = scs->AsyncConvertData("text/ftp-dir",
                               APPLICATION_HTTP_INDEX_FORMAT,
                               mChannel,
                               mURL, 
                               getter_AddRefs(converterListener));
    if (NS_FAILED(rv)) {
        LOG(("(%x) scs->AsyncConvertData failed (rv=%x)\n", this, rv));
        return rv;
    }

    NS_ADDREF(*convertStreamListener = converterListener);
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIRequest::cancel ( in nsresult  aStatus) [inherited]

Cancels the current request.

This will close any open input or output streams and terminate any async requests. Users should normally pass NS_BINDING_ABORTED, although other errors may also be passed. The error passed in will become the value of the status attribute.

Parameters:
aStatusthe reason for canceling this request.

NOTE: most nsIRequest implementations expect aStatus to be a failure code; however, some implementations may allow aStatus to be a success code such as NS_OK. In general, aStatus should be a failure code.

Definition at line 2121 of file nsFtpConnectionThread.cpp.

{
    nsCacheAccessMode access;
    nsresult rv = mCacheEntry->GetAccessGranted(&access);
    if (NS_FAILED(rv)) return PR_FALSE;
    
    // If I'm not granted read access, then I can't reuse it...
    if (!(access & nsICache::ACCESS_READ))
        return PR_FALSE;

    nsLoadFlags flags;
    rv = mChannel->GetLoadFlags(&flags);
    if (NS_FAILED(rv)) return PR_FALSE;

    if (flags & LOAD_FROM_CACHE)
        return PR_TRUE;

    if (flags & LOAD_BYPASS_CACHE)
        return PR_FALSE;
    
    if (flags & VALIDATE_ALWAYS)
        return PR_FALSE;
    
    PRUint32 time;
    if (flags & VALIDATE_ONCE_PER_SESSION) {
        rv = mCacheEntry->GetLastModified(&time);
        if (NS_FAILED(rv)) return PR_FALSE;
        return (mSessionStartTime > time);
    }

    if (flags & VALIDATE_NEVER)
        return PR_TRUE;

    // OK, now we just check the expiration time as usual
    rv = mCacheEntry->GetExpirationTime(&time);
    if (NS_FAILED(rv)) return rv;
    return (NowInSeconds() <= time);
}

Here is the caller graph for this function:

Definition at line 2290 of file nsFtpConnectionThread.cpp.

{
    if (mDRequestForwarder)
        return NS_OK;  // we are already connected.
    
    nsresult rv;

    mState = FTP_COMMAND_CONNECT;
    mNextState = FTP_S_USER;

    rv = Process();

    // check for errors.
    if (NS_FAILED(rv)) {
        LOG(("-- Connect() on Control Connect FAILED with rv = %x\n", rv));
        mInternalError = NS_ERROR_FAILURE;
        mState = FTP_ERROR;
    }

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2633 of file nsFtpConnectionThread.cpp.

{
    LOG(("(%x) ConvertDirspecFromVMS from: \"%s\"\n", this, dirSpec.get()));
    if (dirSpec.IsEmpty()) {
        dirSpec.Insert('.', 0);
    }
    else {
        dirSpec.Insert('/', 0);
        dirSpec.ReplaceSubstring(":[", "/");
        dirSpec.ReplaceChar('.', '/');
        dirSpec.ReplaceChar(']', '/');
    }
    LOG(("(%x) ConvertDirspecFromVMS   to: \"%s\"\n", this, dirSpec.get()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsFtpState::ConvertDirspecToVMS ( nsCString fileSpec) [private]

Definition at line 2617 of file nsFtpConnectionThread.cpp.

{
    LOG(("(%x) ConvertDirspecToVMS from: \"%s\"\n", this, dirSpec.get()));
    if (!dirSpec.IsEmpty()) {
        if (dirSpec.Last() != '/')
            dirSpec.Append('/');
        // we can use the filespec routine if we make it look like a file name
        dirSpec.Append('x');
        ConvertFilespecToVMS(dirSpec);
        dirSpec.Truncate(dirSpec.Length()-1);
    }
    LOG(("(%x) ConvertDirspecToVMS   to: \"%s\"\n", this, dirSpec.get()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsFtpState::ConvertFilespecToVMS ( nsCString fileSpec) [private]

Definition at line 2529 of file nsFtpConnectionThread.cpp.

{
    int ntok=1;
    char *t, *nextToken;
    nsCAutoString fileStringCopy;

    // Get a writeable copy we can strtok with.
    fileStringCopy = fileString;
    t = nsCRT::strtok(fileStringCopy.BeginWriting(), "/", &nextToken);
    if (t) while (nsCRT::strtok(nextToken, "/", &nextToken)) ntok++; // count number of terms (tokens)
    LOG(("(%x) ConvertFilespecToVMS ntok: %d\n", this, ntok));
    LOG(("(%x) ConvertFilespecToVMS from: \"%s\"\n", this, fileString.get()));

    if (fileString.First() == '/') {
        // absolute filespec
        //   /        -> []
        //   /a       -> a (doesn't really make much sense)
        //   /a/b     -> a:[000000]b
        //   /a/b/c   -> a:[b]c
        //   /a/b/c/d -> a:[b.c]d
        if (ntok == 1) {
            if (fileString.Length() == 1) {
                // Just a slash
                fileString.Truncate();
                fileString.AppendLiteral("[]");
            }
            else {
                // just copy the name part (drop the leading slash)
                fileStringCopy = fileString;
                fileString = Substring(fileStringCopy, 1,
                                       fileStringCopy.Length()-1);
            }
        }
        else {
            // Get another copy since the last one was written to.
            fileStringCopy = fileString;
            fileString.Truncate();
            fileString.Append(nsCRT::strtok(fileStringCopy.BeginWriting(), 
                              "/", &nextToken));
            fileString.AppendLiteral(":[");
            if (ntok > 2) {
                for (int i=2; i<ntok; i++) {
                    if (i > 2) fileString.Append('.');
                    fileString.Append(nsCRT::strtok(nextToken,
                                      "/", &nextToken));
                }
            }
            else {
                fileString.AppendLiteral("000000");
            }
            fileString.Append(']');
            fileString.Append(nsCRT::strtok(nextToken, "/", &nextToken));
        }
    } else {
       // relative filespec
        //   a       -> a
        //   a/b     -> [.a]b
        //   a/b/c   -> [.a.b]c
        if (ntok == 1) {
            // no slashes, just use the name as is
        }
        else {
            // Get another copy since the last one was written to.
            fileStringCopy = fileString;
            fileString.Truncate();
            fileString.AppendLiteral("[.");
            fileString.Append(nsCRT::strtok(fileStringCopy.BeginWriting(),
                              "/", &nextToken));
            if (ntok > 2) {
                for (int i=2; i<ntok; i++) {
                    fileString.Append('.');
                    fileString.Append(nsCRT::strtok(nextToken,
                                      "/", &nextToken));
                }
            }
            fileString.Append(']');
            fileString.Append(nsCRT::strtok(nextToken, "/", &nextToken));
        }
    }
    LOG(("(%x) ConvertFilespecToVMS   to: \"%s\"\n", this, fileString.get()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2491 of file nsFtpConnectionThread.cpp.

{
    LOG(("(%x) Data Connection complete.", this));

    if (mDPipe) {
        mDPipe->SetEventSink(nsnull, nsnull);
        mDPipe->Close(NS_ERROR_ABORT);
        mDPipe = 0;
    }
}

Definition at line 2473 of file nsFtpConnectionThread.cpp.

{
    LOG(("(%x) Data Connection established.", this));
    mWaitingForDConn = PR_FALSE;

    // If we no longer have a channel, we don't need this connection
    if (!mChannel) {
        LOG(("    Ignoring data connection"));
        return;
    }

    // sending empty string with (mWaitingForDConn == PR_FALSE) will cause the 
    // control socket to write out its buffer.
    nsCString a("");
    SendFTPCommand(a);
}

Here is the call graph for this function:

Definition at line 619 of file nsFtpConnectionThread.cpp.

{
    nsresult rv;

    LOG(("(%x) trying cached control\n", this));
        
    nsFtpControlConnection* connection;
    (void) gFtpHandler->RemoveConnection(mURL, &connection);

    nsRefPtr<TransportEventForwarder> fwd(new TransportEventForwarder(mChannel));
    if (connection) {
        mControlConnection = connection;
        if (mControlConnection->IsAlive())
        {
            // set stream listener of the control connection to be us.        
            (void) mControlConnection->SetStreamListener(NS_STATIC_CAST(nsIStreamListener*, this));
            
            // read cached variables into us. 
            mServerType = mControlConnection->mServerType;           
            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.
            mControlStatus = NS_OK;
            mReceivedControlData = PR_FALSE;  // For this request, we have not.

            // if we succeed, return.  Otherwise, we need to 
            // create a transport
            rv = mControlConnection->Connect(mProxyInfo, fwd);
            if (NS_SUCCEEDED(rv))
                return rv;
        }
        else 
        {
            LOG(("(%x) isAlive return false\n", this));
            NS_RELEASE(mControlConnection);
        }
    }

    LOG(("(%x) creating control\n", this));
        
    mState = FTP_READ_BUF;
    mNextState = FTP_S_USER;
    
    nsCAutoString host;
    rv = mURL->GetAsciiHost(host);
    if (NS_FAILED(rv)) return rv;

    mControlConnection = new nsFtpControlConnection(host.get(), mPort);
    if (!mControlConnection) return NS_ERROR_OUT_OF_MEMORY;

    NS_ADDREF(mControlConnection);
        
    // Must do it this way 'cuz the channel intercepts the progress notifications.
    (void) mControlConnection->SetStreamListener(NS_STATIC_CAST(nsIStreamListener*, this));

    return mControlConnection->Connect(mProxyInfo, fwd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsFtpState::GetEntityID ( nsACString &  aEntityID)

Definition at line 453 of file nsFtpConnectionThread.cpp.

{
    if (mEntityID.IsEmpty())
        return NS_ERROR_NOT_RESUMABLE;

    aEntityID = mEntityID;
    return NS_OK;
}
nsresult nsFtpState::Init ( nsFTPChannel aChannel,
nsICacheEntryDescriptor cacheEntry,
nsIProxyInfo proxyInfo,
PRUint64  startPos,
const nsACString &  entity 
)

Definition at line 2161 of file nsFtpConnectionThread.cpp.

{
    mKeepRunning = PR_TRUE;
    mCacheEntry = cacheEntry;
    mProxyInfo = proxyInfo;
    mStartPos = startPos;
    mSuppliedEntityID = entity;
    
    // parameter validation
    NS_ASSERTION(aChannel, "FTP: needs a channel");

    mChannel = aChannel; // a straight ref ptr to the channel

    nsresult rv = aChannel->GetURI(getter_AddRefs(mURL));
    if (NS_FAILED(rv))
        return rv;
        
    if (mCacheEntry) {
        if (CanReadEntry()) {
            // XXX - all this code assumes that we only cache directories
            // If we start caching files, this needs to be updated

            // make sure the channel knows wassup
            SetContentType();
            
            NS_ASSERTION(!mDRequestForwarder, "there should not be a data forwarder");
            mDRequestForwarder = new DataRequestForwarder;
            if (!mDRequestForwarder) return NS_ERROR_OUT_OF_MEMORY;
            NS_ADDREF(mDRequestForwarder);

            rv = mDRequestForwarder->Init(mChannel);
            
            nsXPIDLCString serverType;
            (void) mCacheEntry->GetMetaDataElement("servertype", getter_Copies(serverType));
            nsCAutoString serverNum(serverType.get());
            PRInt32 err;
            mServerType = serverNum.ToInteger(&err);
            
            nsCOMPtr<nsIStreamListener> converter;
            rv = BuildStreamConverter(getter_AddRefs(converter));
            if (NS_FAILED(rv)) return rv;
            
            mDRequestForwarder->SetStreamListener(converter);
            mDRequestForwarder->SetCacheEntry(mCacheEntry, PR_FALSE);
            mDRequestForwarder->SetEntityID(EmptyCString());

            // Get a transport to the cached data...
            nsCOMPtr<nsIInputStream> input;
            rv = mCacheEntry->OpenInputStream(0, getter_AddRefs(input));
            if (NS_FAILED(rv)) return rv;

            nsCOMPtr<nsIInputStreamPump> pump;
            rv = NS_NewInputStreamPump(getter_AddRefs(pump), input);
            if (NS_FAILED(rv)) return rv;

            // Pump the cache data downstream
            rv = pump->AsyncRead(mDRequestForwarder, nsnull);
            if (NS_FAILED(rv)) return rv;

            mDPipeRequest = pump;
        }
    }

    nsCAutoString path;
    nsCOMPtr<nsIURL> aURL(do_QueryInterface(mURL));
    if (aURL)
        rv = aURL->GetFilePath(path);
    else
        rv = mURL->GetPath(path);
    if (NS_FAILED(rv)) return rv;

    // Skip leading slash
    char *fwdPtr = path.BeginWriting();
    if (fwdPtr && (*fwdPtr == '/'))
        fwdPtr++;
    if (*fwdPtr != '\0') {
        // now unescape it... %xx reduced inline to resulting character
        PRInt32 len = NS_UnescapeURL(fwdPtr);
        mPath.Assign(fwdPtr, len);

#ifdef DEBUG
        if (mPath.FindCharInSet(CRLF) >= 0)
            NS_ERROR("NewURI() should've prevented this!!!");
#endif
    }

    // pull any username and/or password out of the uri
    nsCAutoString uname;
    rv = mURL->GetUsername(uname);
    if (NS_FAILED(rv))
        return rv;

    if (!uname.IsEmpty() && !uname.EqualsLiteral("anonymous")) {
        mAnonymous = PR_FALSE;
        CopyUTF8toUTF16(NS_UnescapeURL(uname), mUsername);
        
        // return an error if we find a CR or LF in the username
        if (uname.FindCharInSet(CRLF) >= 0)
            return NS_ERROR_MALFORMED_URI;
    }

    nsCAutoString password;
    rv = mURL->GetPassword(password);
    if (NS_FAILED(rv))
        return rv;

    CopyUTF8toUTF16(NS_UnescapeURL(password), mPassword);

    // return an error if we find a CR or LF in the password
    if (mPassword.FindCharInSet(CRLF) >= 0)
        return NS_ERROR_MALFORMED_URI;

    // setup the connection cache key

    PRInt32 port;
    rv = mURL->GetPort(&port);
    if (NS_FAILED(rv)) return rv;

    if (port > 0)
        mPort = port;

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

boolean nsIRequest::isPending ( ) [inherited]

Indicates whether the request is pending.

nsIRequest::isPending is true when there is an outstanding asynchronous event that will make the request no longer be pending. Requests do not necessarily start out pending; in some cases, requests have to be explicitly initiated (e.g. nsIChannel implementations are only pending once asyncOpen returns successfully).

Requests can become pending multiple times during their lifetime.

Returns:
TRUE if the request has yet to reach completion.
FALSE if the request has reached completion (e.g., after OnStopRequest has fired).
Note:
Suspended requests are still considered pending.

Definition at line 2325 of file nsFtpConnectionThread.cpp.

{
    mControlReadCarryOverBuf.Truncate(0);

    NS_IF_RELEASE(mDRequestForwarder);

    mAddressChecked = PR_FALSE;
    mServerIsIPv6 = PR_FALSE;

    // if everything went okay, save the connection. 
    // FIX: need a better way to determine if we can cache the connections.
    //      there are some errors which do not mean that we need to kill the connection
    //      e.g. fnf.

    if (!mControlConnection)
        return;

    // kill the reference to ourselves in the control connection.
    (void) mControlConnection->SetStreamListener(nsnull);

    if (FTP_CACHE_CONTROL_CONNECTION && 
        NS_SUCCEEDED(mInternalError) &&
        NS_SUCCEEDED(mControlStatus) &&
        mControlConnection->IsAlive()) {

        LOG_ALWAYS(("(%x) nsFtpState caching control connection", this));

        // Store connection persistant data
        mControlConnection->mServerType = mServerType;           
        mControlConnection->mPassword = mPassword;
        mControlConnection->mPwd = mPwd;
        nsresult rv = gFtpHandler->InsertConnection(mURL, mControlConnection);
        // Can't cache it?  Kill it then.  
        mControlConnection->Disconnect(rv);
    } 
    else
        mControlConnection->Disconnect(NS_BINDING_ABORTED);

    NS_RELEASE(mControlConnection);
 
    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsFtpState::MoveToNextState ( FTP_STATE  nextState) [private]

Definition at line 682 of file nsFtpConnectionThread.cpp.

{
    if (NS_FAILED(mInternalError)) 
    {
        mState = FTP_ERROR;
        LOG(("(%x) FAILED (%x)\n", this, mInternalError));
    }
    else
    {
        mState = FTP_READ_BUF;
        mNextState = nextState;
    }  
}

Here is the caller graph for this function:

void nsIStreamListener::onDataAvailable ( in nsIRequest  aRequest,
in nsISupports  aContext,
in nsIInputStream  aInputStream,
in unsigned long  aOffset,
in unsigned long  aCount 
) [inherited]

Called when the next chunk of data (corresponding to the request) may be read without blocking the calling thread.

The onDataAvailable impl must read exactly |aCount| bytes of data before returning.

Parameters:
aRequestrequest corresponding to the source of the data
aContextuser defined context
aInputStreaminput stream containing the data chunk
aOffsetNumber of bytes that were sent in previous onDataAvailable calls for this request. In other words, the sum of all previous count parameters. If that number is greater than or equal to 2^32, this parameter will be PR_UINT32_MAX (2^32 - 1).
aCountnumber of bytes available in the stream

NOTE: The aInputStream parameter must implement readSegments.

An exception thrown from onDataAvailable has the side-effect of causing the request to be canceled.

void nsIRequestObserver::onStartRequest ( in nsIRequest  aRequest,
in nsISupports  aContext 
) [inherited]

Called to signify the beginning of an asynchronous request.

Parameters:
aRequestrequest being observed
aContextuser defined context

An exception thrown from onStartRequest has the side-effect of causing the request to be canceled.

Here is the caller graph for this function:

void nsIRequestObserver::onStopRequest ( in nsIRequest  aRequest,
in nsISupports  aContext,
in nsresult  aStatusCode 
) [inherited]

Called to signify the end of an asynchronous request.

This call is always preceded by a call to onStartRequest.

Parameters:
aRequestrequest being observed
aContextuser defined context
aStatusCodereason for stopping (NS_OK if completed successfully)

An exception thrown from onStopRequest is generally ignored.

Here is the caller graph for this function:

Definition at line 697 of file nsFtpConnectionThread.cpp.

{
    nsresult    rv = NS_OK;
    PRBool      processingRead = PR_TRUE;
    
    while (mKeepRunning && processingRead) 
    {
        switch(mState) 
        {
          case FTP_COMMAND_CONNECT:
              KillControlConnection();
              LOG(("(%x) Establishing control connection...", this));
              mInternalError = EstablishControlConnection();  // sets mState
              if (NS_FAILED(mInternalError)) {
                  mState = FTP_ERROR;
                  LOG(("(%x) FAILED\n", this));
              }
              else
                  LOG(("(%x) SUCCEEDED\n", this));
              break;
    
          case FTP_READ_BUF:
              LOG(("(%x) Waiting for control data (%x)...", this, rv));
              processingRead = PR_FALSE;
              break;
          
          case FTP_ERROR: // xx needs more work to handle dropped control connection cases
              if ((mTryingCachedControl && mResponseCode == 530 &&
                  mInternalError == NS_ERROR_FTP_PASV) ||
                  (mResponseCode == 425 &&
                  mInternalError == NS_ERROR_FTP_PASV)) {
                  // The user was logged out during an pasv operation
                  // we want to restart this request with a new control
                  // channel.
                  mState = FTP_COMMAND_CONNECT;
              }
              else if (mResponseCode == 421 && 
                       mInternalError != NS_ERROR_FTP_LOGIN) {
                  // The command channel dropped for some reason.
                  // Fire it back up, unless we were trying to login
                  // in which case the server might just be telling us
                  // that the max number of users has been reached...
                  mState = FTP_COMMAND_CONNECT;
              } else {
                  LOG(("(%x) FTP_ERROR - Calling StopProcessing\n", this));
                  rv = StopProcessing();
                  NS_ASSERTION(NS_SUCCEEDED(rv), "StopProcessing failed.");
                  processingRead = PR_FALSE;
              }
              break;
          
          case FTP_COMPLETE:
              LOG(("(%x) COMPLETE\n", this));
              rv = StopProcessing();
              NS_ASSERTION(NS_SUCCEEDED(rv), "StopProcessing failed.");
              processingRead = PR_FALSE;
              break;

// USER           
          case FTP_S_USER:
            rv = S_user();
            
            if (NS_FAILED(rv))
                mInternalError = NS_ERROR_FTP_LOGIN;
            
            MoveToNextState(FTP_R_USER);
            break;
            
          case FTP_R_USER:
            mState = R_user();
            
            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FTP_LOGIN;
            
            break;
// PASS            
          case FTP_S_PASS:
            rv = S_pass();
            
            if (NS_FAILED(rv))
                mInternalError = NS_ERROR_FTP_LOGIN;
            
            MoveToNextState(FTP_R_PASS);
            break;
            
          case FTP_R_PASS:
            mState = R_pass();
            
            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FTP_LOGIN;
            
            break;
// ACCT            
          case FTP_S_ACCT:
            rv = S_acct();
            
            if (NS_FAILED(rv))
                mInternalError = NS_ERROR_FTP_LOGIN;
            
            MoveToNextState(FTP_R_ACCT);
            break;
            
          case FTP_R_ACCT:
            mState = R_acct();
            
            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FTP_LOGIN;
            
            break;

// SYST            
          case FTP_S_SYST:
            rv = S_syst();
            
            if (NS_FAILED(rv))
                mInternalError = NS_ERROR_FTP_LOGIN;
            
            MoveToNextState(FTP_R_SYST);
            break;
            
          case FTP_R_SYST:
            mState = R_syst();
            
            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FTP_LOGIN;

            break;

// TYPE            
          case FTP_S_TYPE:
            rv = S_type();
            
            if (NS_FAILED(rv))
                mInternalError = rv;
            
            MoveToNextState(FTP_R_TYPE);
            break;
            
          case FTP_R_TYPE:
            mState = R_type();
            
            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FAILURE;
            
            break;
// CWD            
          case FTP_S_CWD:
            rv = S_cwd();
            
            if (NS_FAILED(rv))
                mInternalError = NS_ERROR_FTP_CWD;
            
            MoveToNextState(FTP_R_CWD);
            break;
            
          case FTP_R_CWD:
            mState = R_cwd();
            
            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FTP_CWD;
            break;
       
// LIST
          case FTP_S_LIST:
            rv = S_list();

            if (rv == NS_ERROR_NOT_RESUMABLE)
                mInternalError = rv;
            else if (NS_FAILED(rv))
                mInternalError = NS_ERROR_FTP_CWD;
            
            MoveToNextState(FTP_R_LIST);
            break;

          case FTP_R_LIST:        
            mState = R_list();
            
            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FAILURE;

            break;

// SIZE            
          case FTP_S_SIZE:
            rv = S_size();
            
            if (NS_FAILED(rv))
                mInternalError = rv;
            
            MoveToNextState(FTP_R_SIZE);
            break;
            
          case FTP_R_SIZE: 
            mState = R_size();
            
            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FAILURE;
            
            break;

// REST        
          case FTP_S_REST:
            rv = S_rest();
            
            if (NS_FAILED(rv))
                mInternalError = rv;
            
            MoveToNextState(FTP_R_REST);
            break;
            
          case FTP_R_REST:
            mState = R_rest();
            
            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FAILURE;
            
            break;

// MDTM
          case FTP_S_MDTM:
            rv = S_mdtm();
            if (NS_FAILED(rv))
                mInternalError = rv;
            MoveToNextState(FTP_R_MDTM);
            break;

          case FTP_R_MDTM:
            mState = R_mdtm();

            // Don't want to overwrite a more explicit status code
            if (FTP_ERROR == mState && NS_SUCCEEDED(mInternalError))
                mInternalError = NS_ERROR_FAILURE;
            
            break;
            
// RETR        
          case FTP_S_RETR:
            rv = S_retr();
            
            if (NS_FAILED(rv)) 
                mInternalError = rv;
            
            MoveToNextState(FTP_R_RETR);
            break;
            
          case FTP_R_RETR:

            mState = R_retr();
            
            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FAILURE;
            
            break;
            
// STOR        
          case FTP_S_STOR:
            rv = S_stor();

            if (NS_FAILED(rv))
                mInternalError = rv;
            
            MoveToNextState(FTP_R_STOR);
            break;
            
          case FTP_R_STOR:
            mState = R_stor();

            if (FTP_ERROR == mState)
                mInternalError = NS_ERROR_FAILURE;

            break;
            
// PASV        
          case FTP_S_PASV:
            rv = S_pasv();

            if (NS_FAILED(rv))
                mInternalError = NS_ERROR_FTP_PASV;
            
            MoveToNextState(FTP_R_PASV);
            break;
            
          case FTP_R_PASV:
            mState = R_pasv();

            if (FTP_ERROR == mState) 
                mInternalError = NS_ERROR_FTP_PASV;

            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:
            ;
            
        } 
    } 

return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1340 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode/100 == 2)
        return FTP_S_SYST;
    else
        return FTP_ERROR;
}

Here is the caller graph for this function:

Definition at line 1377 of file nsFtpConnectionThread.cpp.

                  {
    if (mResponseCode/100 == 2) {
        if (mAction == PUT)
            return FTP_S_STOR;
        
        return FTP_S_LIST;
    }
    
    return FTP_ERROR;
}

Here is the caller graph for this function:

Definition at line 1538 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode/100 == 1) {
        nsresult rv = mDPipeRequest->Resume();
        if (NS_FAILED(rv)) {
            LOG(("(%x) dataPipe->Resume (rv=%x)\n", this, rv));
            return FTP_ERROR;
        }
        return FTP_READ_BUF;
    }

    if (mResponseCode/100 == 2) {
        //(DONE)
        mNextState = FTP_COMPLETE;
        return FTP_COMPLETE;
    }
    return FTP_ERROR;
}

Here is the caller graph for this function:

Definition at line 1434 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode == 213) {
        mResponseMsg.Cut(0,4);
        mResponseMsg.Trim(" \t\r\n");
        // yyyymmddhhmmss
        if (mResponseMsg.Length() != 14) {
            NS_ASSERTION(mResponseMsg.Length() == 14, "Unknown MDTM response");
        } else {
            mModTime = mResponseMsg;
        }
    }

    mEntityID.Truncate();
    mEntityID.AppendInt(PRInt64(mFileSize));
    mEntityID.Append('/');
    mEntityID.Append(mModTime);
    mDRequestForwarder->SetEntityID(mEntityID);

    // if we tried downloading this, lets try restarting it...
    if (mDRequestForwarder && mDRequestForwarder->GetBytesTransfered() > 0) {
        mStartPos = mDRequestForwarder->GetBytesTransfered();
        return FTP_S_REST;
    }
    
    // We weren't asked to resume
    if (mStartPos == LL_MAXUINT)
        return FTP_S_RETR;

    //if (our entityID == supplied one (if any))
    if (mSuppliedEntityID.IsEmpty() ||
        mEntityID.Equals(mSuppliedEntityID))
    {
        return FTP_S_REST;
    } else {
        mInternalError = NS_ERROR_ENTITY_CHANGED;
        mResponseMsg.Truncate();
        return FTP_ERROR;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1181 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode/100 == 3) {
        // send account info
        return FTP_S_ACCT;
    } else if (mResponseCode/100 == 2) {
        // logged in
        return FTP_S_SYST;
    } else if (mResponseCode == 503) {
        // start over w/ the user command.
        // note: the password was successful, and it's stored in mPassword
        mRetryPass = PR_FALSE;
        return FTP_S_USER;
    } else if (mResponseCode/100 == 5 || mResponseCode==421) {
        // There is no difference between a too-many-users error,
        // a wrong-password error, or any other sort of error
        // So we need to tell wallet to forget the password if we had one,
        // and error out. That will then show the error message, and the
        // user can retry if they want to

        if (!mPassword.IsEmpty()) {
            nsCOMPtr<nsIPasswordManager> pm = do_GetService(NS_PASSWORDMANAGER_CONTRACTID);
            if (pm) {
                nsCAutoString prePath;
                nsresult rv = mURL->GetPrePath(prePath);
                NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get prepath");
                if (NS_SUCCEEDED(rv)) {
                    pm->RemoveUser(prePath, EmptyString());
                }
            }
        }

        // If the login was anonymous, and it failed, try again with a username
        if (mAnonymous) {
            mAnonymous = PR_FALSE;
            return FTP_S_USER;
        }

        mRetryPass = PR_TRUE;
        return FTP_ERROR;
    }
    // unexpected response code
    return FTP_ERROR;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1724 of file nsFtpConnectionThread.cpp.

                   {
    nsresult rv;
    PRInt32 port;

    if (mResponseCode/100 != 2)  {
        return FTP_ERROR;
    }

    char *response = ToNewCString(mResponseMsg);
    if (!response) return FTP_ERROR;
    char *ptr = response;

    // Make sure to ignore the address in the PASV response (bug 370559)
    if (mServerIsIPv6) {
        // The returned string is of the form
        // text (|||ppp|)
        // Where '|' can be any single character
        char delim;
        while (*ptr && *ptr != '(') ptr++;
        if (*ptr++ != '(') {
            return FTP_ERROR;
        }
        delim = *ptr++;
        if (!delim || *ptr++ != delim || *ptr++ != delim || 
            *ptr < '0' || *ptr > '9') {
            return FTP_ERROR;
        }
        port = 0;
        do {
            port = port * 10 + *ptr++ - '0';
        } while (*ptr >= '0' && *ptr <= '9');
        if (*ptr++ != delim || *ptr != ')') {
            return FTP_ERROR;
        }
    } else {
        // The returned address string can be of the form
        // (xxx,xxx,xxx,xxx,ppp,ppp) or
        //  xxx,xxx,xxx,xxx,ppp,ppp (without parens)
        PRInt32 h0, h1, h2, h3, p0, p1;

        PRUint32 fields = 0;
        // First try with parens
        while (*ptr && *ptr != '(')
            ++ptr;
        if (*ptr) {
            ++ptr;
            fields = PR_sscanf(ptr, 
                               "%ld,%ld,%ld,%ld,%ld,%ld",
                               &h0, &h1, &h2, &h3, &p0, &p1);
        }
        if (!*ptr || fields < 6) {
            // OK, lets try w/o parens
            ptr = response;
            while (*ptr && *ptr != ',')
                ++ptr;
            if (*ptr) {
                // backup to the start of the digits
                do {
                    ptr--;
                } while ((ptr >=response) && (*ptr >= '0') && (*ptr <= '9'));
                ptr++; // get back onto the numbers
                fields = PR_sscanf(ptr, 
                                   "%ld,%ld,%ld,%ld,%ld,%ld",
                                   &h0, &h1, &h2, &h3, &p0, &p1);
            }
        }

        NS_ASSERTION(fields == 6, "Can't parse PASV response");
        if (fields < 6) {
            return FTP_ERROR;
        }

        port = ((PRInt32) (p0<<8)) + p1;
    }

    nsMemory::Free(response);

    PRBool newDataConn = PR_TRUE;
    if (mDPipeRequest) {
        // Reuse this connection only if its still alive, and the port
        // is the same

        if (mDPipe) {
            PRInt32 oldPort;
            nsresult rv = mDPipe->GetPort(&oldPort);
            if (NS_SUCCEEDED(rv)) {
                if (oldPort == port) {
                    PRBool isAlive;
                    if (NS_SUCCEEDED(mDPipe->IsAlive(&isAlive)) && isAlive)
                        newDataConn = PR_FALSE;
                }
            }
        }

        if (newDataConn) {
            mDPipeRequest->Cancel(NS_ERROR_ABORT);
            mDPipeRequest = 0;
            mDPipe = 0;
        } else {
            mDRequestForwarder->SetRetrying(PR_FALSE);
        }
    }

    if (newDataConn) {
        // now we know where to connect our data channel
        nsCOMPtr<nsISocketTransportService> sts = do_GetService(kSocketTransportServiceCID, &rv);
        
        rv =  sts->CreateTransport(nsnull, 0,
                                   nsDependentCString(mServerAddress), port, mProxyInfo,
                                   getter_AddRefs(mDPipe)); // the data socket
        if (NS_FAILED(rv)) return FTP_ERROR;
        
        LOG(("(%x) Created Data Transport (%s:%x)\n", this, mServerAddress, port));
        
        if (!mDRequestForwarder) {
            mDRequestForwarder = new DataRequestForwarder;
            if (!mDRequestForwarder) return FTP_ERROR;
            NS_ADDREF(mDRequestForwarder);
            
            rv = mDRequestForwarder->Init(mChannel);
            if (NS_FAILED(rv)){
                LOG(("(%x) forwarder->Init failed (rv=%x)\n", this, rv));
                return FTP_ERROR;
            }
        }
        
        mWaitingForDConn = PR_TRUE;

        // hook ourself up as a proxy for status notifications
        nsCOMPtr<nsIEventQueue> eventQ;
        rv = NS_GetCurrentEventQ(getter_AddRefs(eventQ));
        if (NS_FAILED(rv)){
            LOG(("(%x) NS_GetCurrentEventQ failed (rv=%x)\n", this, rv));
            return FTP_ERROR;
        }
        rv = mDPipe->SetEventSink(NS_STATIC_CAST(nsITransportEventSink*, mDRequestForwarder), eventQ);
        if (NS_FAILED(rv)){
            LOG(("(%x) forwarder->SetEventSink failed (rv=%x)\n", this, rv));
            return FTP_ERROR;
        }

        if (mAction == PUT) {
            NS_ASSERTION(!mRETRFailed, "Failed before uploading");
            mDRequestForwarder->Uploading(PR_TRUE, mWriteCount);

            // nsIUploadChannel requires the upload stream to support ReadSegments.
            // therefore, we can open an unbuffered socket output stream.
            nsCOMPtr<nsIOutputStream> output;
            rv = mDPipe->OpenOutputStream(nsITransport::OPEN_UNBUFFERED, 0, 0,
                                          getter_AddRefs(output));
            if (NS_FAILED(rv)) return FTP_ERROR;

            // perform the data copy on the socket transport thread.  we do this
            // because "output" is a socket output stream, so the result is that
            // all work will be done on the socket transport thread.
            nsCOMPtr<nsIEventTarget> stEventTarget = do_GetService(kSocketTransportServiceCID, &rv);
            if (NS_FAILED(rv)) return FTP_ERROR;
            
            nsCOMPtr<nsIAsyncStreamCopier> copier;
            rv = NS_NewAsyncStreamCopier(getter_AddRefs(copier),
                                         mWriteStream,
                                         output,
                                         stEventTarget,
                                         PR_TRUE,   // mWriteStream is buffered
                                         PR_FALSE); // output is NOT buffered
            if (NS_FAILED(rv)) return FTP_ERROR;
        
            rv = copier->AsyncCopy(mDRequestForwarder, nsnull);
            if (NS_FAILED(rv)) return FTP_ERROR;

            // hold a reference to the copier so we can cancel it if necessary.
            mDPipeRequest = copier;

            // update the current working directory before sending the STOR
            // command.  this is needed since we might be reusing a control
            // connection.
            return FTP_S_CWD;
        }

        //
        // else, we are reading from the data connection...
        //

        // open a buffered, asynchronous socket input stream
        nsCOMPtr<nsIInputStream> input;
        rv = mDPipe->OpenInputStream(0,
                                     FTP_DATA_CHANNEL_SEG_SIZE,
                                     FTP_DATA_CHANNEL_SEG_COUNT,
                                     getter_AddRefs(input));
        if (NS_FAILED(rv)) {
            LOG(("(%x) OpenInputStream failed (rv=%x)\n", this, rv));
            return FTP_ERROR;
        }

        // pump data to the request forwarder...
        nsCOMPtr<nsIInputStreamPump> pump;
        rv = NS_NewInputStreamPump(getter_AddRefs(pump), input, nsInt64(-1),
                                   nsInt64(-1), 0, 0, PR_TRUE);
        if (NS_FAILED(rv)) {
            LOG(("(%x) NS_NewInputStreamPump failed (rv=%x)\n", this, rv));
            return FTP_ERROR;
        }
        
        rv = pump->AsyncRead(mDRequestForwarder, nsnull);
        if (NS_FAILED(rv)) {
            LOG(("(%x) AsyncRead failed (rv=%x)\n", this, rv));
            return FTP_ERROR;
        }

        // hold a reference to the input stream pump so we can cancel it.
        mDPipeRequest = pump;

        // Suspend the read
        // If we don't do this, then the remote server could close the
        // connection before we get the error message, and then we process the
        // onstop as if it was from the real data connection
        rv = mDPipeRequest->Suspend();
        if (NS_FAILED(rv)){
            LOG(("(%x) dataPipe->Suspend failed (rv=%x)\n", this, rv));
            return FTP_ERROR;
        }
    }

    if (mRETRFailed)
        return FTP_S_CWD;
    return FTP_S_SIZE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1232 of file nsFtpConnectionThread.cpp.

                  {
    if (mResponseCode/100 != 2) 
        return FTP_ERROR;
    nsCAutoString respStr(mResponseMsg);
    PRInt32 pos = respStr.FindChar('"');
    if (pos > -1) {
        respStr.Cut(0,pos+1);
        pos = respStr.FindChar('"');
        if (pos > -1) {
            respStr.Truncate(pos);
            if (mServerType == FTP_VMS_TYPE)
                ConvertDirspecFromVMS(respStr);
            if (respStr.Last() != '/')
                respStr.Append('/');
            mPwd = respStr;
        }
    }
    return FTP_S_TYPE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1625 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode/100 == 4) {
        // If REST fails, then we can't resume
        mEntityID.Truncate();

        mInternalError = NS_ERROR_NOT_RESUMABLE;
        mResponseMsg.Truncate();

        return FTP_ERROR;
    }
   
    return FTP_S_RETR; 
}

Here is the caller graph for this function:

Definition at line 1575 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode/100 == 2) {
        //(DONE)
        mNextState = FTP_COMPLETE;
        return FTP_COMPLETE;
    }

    if (mResponseCode/100 == 1) {
        // We're going to grab a file, not a directory. So we need to clear
        // any cache entry, otherwise we'll have problems reading it later.
        // See bug 122548
        if (mCacheEntry) {
            (void)mCacheEntry->Doom();
            mCacheEntry = nsnull;
        }
        nsresult rv = mDPipeRequest->Resume();
        if (NS_FAILED(rv)) {
            LOG(("(%x) dataPipe->Resume (rv=%x)\n", this, rv));
            return FTP_ERROR;
        }
        return FTP_READ_BUF;
    }
    
    // These error codes are related to problems with the connection.  
    // If we encounter any at this point, do not try CWD and abort.
    if (mResponseCode == 421 || mResponseCode == 425 || mResponseCode == 426)
        return FTP_ERROR;

    if (mResponseCode/100 == 5) {
        mRETRFailed = PR_TRUE;
        mDRequestForwarder->SetRetrying(PR_TRUE);
        return FTP_S_PASV;
    }

    return FTP_S_CWD;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1402 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode/100 == 2) {
        PR_sscanf(mResponseMsg.get() + 4, "%llu", &mFileSize);
        PRUint32 size32;
        LL_L2UI(size32, mFileSize);
        if (NS_FAILED(mChannel->SetContentLength(size32))) return FTP_ERROR;

        // Set the 64-bit length too
        mChannel->SetPropertyAsUint64(NS_CHANNEL_PROP_CONTENT_LENGTH,
                                      mFileSize);

        mDRequestForwarder->SetFileSize(mFileSize);
    }

    // We may want to be able to resume this
    return FTP_S_MDTM;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1673 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode/100 == 2) {
        //(DONE)
        mNextState = FTP_COMPLETE;
        return FTP_COMPLETE;
    }

    if (mResponseCode/100 == 1) {
        LOG(("(%x) writing on Data Transport\n", this));
        return FTP_READ_BUF;
    }

   return FTP_ERROR;
}

Here is the caller graph for this function:

Definition at line 1259 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode/100 == 2) {
        if (( mResponseMsg.Find("L8") > -1) || 
            ( mResponseMsg.Find("UNIX") > -1) || 
            ( mResponseMsg.Find("BSD") > -1) ||
            ( mResponseMsg.Find("MACOS Peter's Server") > -1) ||
            ( mResponseMsg.Find("MACOS WebSTAR FTP") > -1) ||
            ( mResponseMsg.Find("MVS") > -1) ||
            ( mResponseMsg.Find("OS/390") > -1))
        {
            mServerType = FTP_UNIX_TYPE;
        }
        else if ( ( mResponseMsg.Find("WIN32", PR_TRUE) > -1) ||
                  ( mResponseMsg.Find("windows", PR_TRUE) > -1) )
        {
            mServerType = FTP_NT_TYPE;
        }
        else if ( mResponseMsg.Find("OS/2", PR_TRUE) > -1)
        {
            mServerType = FTP_OS2_TYPE;
        }
        else if ( mResponseMsg.Find("VMS", PR_TRUE) > -1)
        {
            mServerType = FTP_VMS_TYPE;
        }
        else
        {
            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;

            // XXX(darin): this code should not be dictating UI like this!
            nsCOMPtr<nsIPrompt> prompter;
            mChannel->GetCallback(prompter);
            if (prompter)
                prompter->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;
    }

    if (mResponseCode/100 == 5) {   
        // server didn't like the SYST command.  Probably (500, 501, 502)
        // No clue.  We will just hope it is UNIX type server.
        mServerType = FTP_UNIX_TYPE;

        return FTP_S_PWD;
    }
    return FTP_ERROR;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1354 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode/100 != 2) 
        return FTP_ERROR;
    
    return FTP_S_PASV;
}

Here is the caller graph for this function:

Definition at line 1077 of file nsFtpConnectionThread.cpp.

                   {
    if (mResponseCode/100 == 3) {
        // send off the password
        return FTP_S_PASS;
    } else if (mResponseCode/100 == 2) {
        // no password required, we're already logged in
        return FTP_S_SYST;
    } else if (mResponseCode/100 == 5) {
        // problem logging in. typically this means the server
        // has reached it's user limit.
        return FTP_ERROR;
    } else {
        // LOGIN FAILED
        if (mAnonymous) {
            // we just tried to login anonymously and failed.
            // kick back out to S_user() and try again after
            // gathering uname/pwd info from the user.
            mAnonymous = PR_FALSE;
            return FTP_S_USER;
        } else {
            return FTP_ERROR;
        }
    }
}

Here is the caller graph for this function:

void nsIRequest::resume ( ) [inherited]

Resumes the current request.

This may have the effect of re-opening any underlying transport and will resume the delivery of data to any open streams.

Definition at line 1334 of file nsFtpConnectionThread.cpp.

                   {
    nsCString acctString("ACCT noaccount" CRLF);
    return SendFTPCommand(acctString);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsFtpState::S_cwd ( ) [private]

Definition at line 1362 of file nsFtpConnectionThread.cpp.

                  {
    nsCAutoString cwdStr;
    if (mAction != PUT)
        cwdStr = mPath;
    if (cwdStr.IsEmpty() || cwdStr.First() != '/')
        cwdStr.Insert(mPwd,0);
    if (mServerType == FTP_VMS_TYPE)
        ConvertDirspecToVMS(cwdStr);
    cwdStr.Insert("CWD ",0);
    cwdStr.Append(CRLF);

    return SendFTPCommand(cwdStr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1481 of file nsFtpConnectionThread.cpp.

                   {
    nsresult rv;

    if (!mDRequestForwarder) 
        return NS_ERROR_FAILURE;

    rv = SetContentType();
    
    if (NS_FAILED(rv)) 
        return FTP_ERROR;
    
    // save off the server type if we are caching.
    if(mCacheEntry) {
        nsCAutoString serverType;
        serverType.AppendInt(mServerType);
        (void) mCacheEntry->SetMetaDataElement("servertype", serverType.get());
    }

    nsCOMPtr<nsIStreamListener> converter;
    
    rv = BuildStreamConverter(getter_AddRefs(converter));
    if (NS_FAILED(rv)) {
        // clear mResponseMsg which is displayed to the user.
        // TODO: we should probably set this to something 
        // meaningful.
        mResponseMsg = "";
        return rv;
    }
    
    // the data forwarder defaults to sending notifications
    // to the channel.  Lets hijack and send the notifications
    // to the stream converter.
    mDRequestForwarder->SetStreamListener(converter);
    mDRequestForwarder->SetCacheEntry(mCacheEntry, PR_TRUE);
    // dir listings aren't resumable
    NS_ASSERTION(mSuppliedEntityID.IsEmpty(),
                 "Entity ID given to directory request");
    NS_ASSERTION(mStartPos == LL_MAXUINT || mStartPos == nsUint64(0),
                 "Non-initial start position given to directory request");
    if (!mSuppliedEntityID.IsEmpty() || (mStartPos != LL_MAXUINT && mStartPos != nsUint64(0))) {
        // If we reach this code, then the caller is in error
        return NS_ERROR_NOT_RESUMABLE;
    }

    mDRequestForwarder->SetEntityID(EmptyCString());

    nsCAutoString listString;
    if (mServerType == FTP_VMS_TYPE)
        listString.AssignLiteral("LIST *.*;0" CRLF);
    else
        listString.AssignLiteral("LIST" CRLF);

    return SendFTPCommand(listString);

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1421 of file nsFtpConnectionThread.cpp.

                   {
    nsCAutoString mdtmBuf(mPath);
    if (mdtmBuf.IsEmpty() || mdtmBuf.First() != '/')
        mdtmBuf.Insert(mPwd,0);
    if (mServerType == FTP_VMS_TYPE)
        ConvertFilespecToVMS(mdtmBuf);
    mdtmBuf.Insert("MDTM ",0);
    mdtmBuf.Append(CRLF);

    return SendFTPCommand(mdtmBuf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1104 of file nsFtpConnectionThread.cpp.

                   {
    nsresult rv;
    nsCAutoString passwordStr("PASS ");

    mResponseMsg = "";

    if (mAnonymous) {
        if (!mPassword.IsEmpty()) {
            // XXX Is UTF-8 the best choice?
            AppendUTF16toUTF8(mPassword, passwordStr);
        } else {
            nsXPIDLCString anonPassword;
            PRBool useRealEmail = PR_FALSE;
            nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
            if (prefs) {
                rv = prefs->GetBoolPref("advanced.mailftp", &useRealEmail);
                if (NS_SUCCEEDED(rv) && useRealEmail)
                    prefs->GetCharPref("network.ftp.anonymous_password", getter_Copies(anonPassword));
            }
            if (!anonPassword.IsEmpty()) {
                passwordStr.AppendASCII(anonPassword);
            } else {
                // We need to default to a valid email address - bug 101027
                // example.com is reserved (rfc2606), so use that
                passwordStr.AppendLiteral("mozilla@example.com");
            }
        }
    } else {
        if (mPassword.IsEmpty() || mRetryPass) {
            nsCOMPtr<nsIAuthPrompt> prompter;
            mChannel->GetCallback(prompter);
            if (!prompter)
                return NS_ERROR_NOT_INITIALIZED;

            nsXPIDLString passwd;
            PRBool retval;
            
            nsCAutoString prePath;
            rv = mURL->GetPrePath(prePath);
            if (NS_FAILED(rv)) return rv;
            NS_ConvertUTF8toUCS2 prePathU(prePath);
            
            nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
            if (NS_FAILED(rv)) return rv;

            nsCOMPtr<nsIStringBundle> bundle;
            rv = bundleService->CreateBundle(NECKO_MSGS_URL, getter_AddRefs(bundle));

            nsXPIDLString formatedString;
            const PRUnichar *formatStrings[2] = { mUsername.get(), prePathU.get() };
            rv = bundle->FormatStringFromName(NS_LITERAL_STRING("EnterPasswordFor").get(),
                                              formatStrings, 2,
                                              getter_Copies(formatedString)); 

            if (NS_FAILED(rv)) return rv;
            rv = prompter->PromptPassword(nsnull,
                                          formatedString,
                                          prePathU.get(), 
                                          nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY,
                                          getter_Copies(passwd), &retval);

            // we want to fail if the user canceled. Note here that if they want
            // a blank password, we will pass it along.
            if (!retval)
                return NS_ERROR_FAILURE;

            mPassword = passwd;
        }
        // XXX Is UTF-8 the best choice?
        AppendUTF16toUTF8(mPassword, passwordStr);
    }
    passwordStr.Append(CRLF);

    return SendFTPCommand(passwordStr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1690 of file nsFtpConnectionThread.cpp.

                   {
    nsresult rv;

    if (mAddressChecked == PR_FALSE) {
        // Find socket address
        mAddressChecked = PR_TRUE;
        nsITransport *controlSocket = mControlConnection->Transport();
        if (!controlSocket) return FTP_ERROR;
        nsCOMPtr<nsISocketTransport> sTrans = do_QueryInterface(controlSocket, &rv);
        
        if (sTrans) {
            PRNetAddr addr;
            rv = sTrans->GetPeerAddr(&addr);
            if (NS_SUCCEEDED(rv)) {
                mServerIsIPv6 = addr.raw.family == PR_AF_INET6 &&
                                !PR_IsNetAddrType(&addr, PR_IpAddrV4Mapped);
                PR_NetAddrToString(&addr, mServerAddress,
                                   sizeof(mServerAddress));
            }
        }
    }

    const char * string;
    if (mServerIsIPv6)
        string = "EPSV" CRLF;
    else
        string = "PASV" CRLF;

    nsCString pasvString(string);
    return SendFTPCommand(pasvString);
    
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsFtpState::S_pwd ( ) [private]

Definition at line 1226 of file nsFtpConnectionThread.cpp.

                  {
    nsCString pwdStr("PWD" CRLF);
    return SendFTPCommand(pwdStr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1614 of file nsFtpConnectionThread.cpp.

                   {
    
    nsCAutoString restString("REST ");
    // The PRInt64 cast is needed to avoid ambiguity
    restString.AppendInt(PRInt64(PRUint64(mStartPos)), 10);
    restString.Append(CRLF);

    return SendFTPCommand(restString);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1557 of file nsFtpConnectionThread.cpp.

                   {
    nsresult rv = NS_OK;
    nsCAutoString retrStr(mPath);
    if (retrStr.IsEmpty() || retrStr.First() != '/')
        retrStr.Insert(mPwd,0);
    if (mServerType == FTP_VMS_TYPE)
        ConvertFilespecToVMS(retrStr);
    retrStr.Insert("RETR ",0);
    retrStr.Append(CRLF);
    
    if (!mDRequestForwarder)
        return NS_ERROR_FAILURE;
    
    rv = SendFTPCommand(retrStr);
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1389 of file nsFtpConnectionThread.cpp.

                   {
    nsCAutoString sizeBuf(mPath);
    if (sizeBuf.IsEmpty() || sizeBuf.First() != '/')
        sizeBuf.Insert(mPwd,0);
    if (mServerType == FTP_VMS_TYPE)
        ConvertFilespecToVMS(sizeBuf);
    sizeBuf.Insert("SIZE ",0);
    sizeBuf.Append(CRLF);

    return SendFTPCommand(sizeBuf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1640 of file nsFtpConnectionThread.cpp.

                   {
    NS_ASSERTION(mWriteStream, "we're trying to upload without any data");

    if (!mWriteStream)
        return NS_ERROR_FAILURE;

    NS_ASSERTION(mAction == PUT, "Wrong state to be here");
    
    nsCAutoString storStr;
    nsresult rv;
    nsCOMPtr<nsIURL> aURL(do_QueryInterface(mURL, &rv));
    if (NS_FAILED(rv)) return rv;

    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);
    }
    if (mServerType == FTP_VMS_TYPE) {
        ConvertFilespecToVMS(storStr);
    }
    NS_UnescapeURL(storStr);
    storStr.Insert("STOR ",0);
    storStr.Append(CRLF);

    return SendFTPCommand(storStr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1253 of file nsFtpConnectionThread.cpp.

                   {
    nsCString systString("SYST" CRLF);
    return SendFTPCommand( systString );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1348 of file nsFtpConnectionThread.cpp.

                   {
    nsCString typeString("TYPE I" CRLF);
    return SendFTPCommand(typeString);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1018 of file nsFtpConnectionThread.cpp.

                   {
    // some servers on connect send us a 421 or 521.  (84525) (141784)
    if ((mResponseCode == 421) || (mResponseCode == 521))
        return NS_ERROR_FAILURE;

    nsresult rv;
    nsCAutoString usernameStr("USER ");

    if (mAnonymous) {
        usernameStr.AppendLiteral("anonymous");
    } else {
        if (mUsername.IsEmpty()) {
            nsCOMPtr<nsIAuthPrompt> prompter;
            mChannel->GetCallback(prompter);
            if (!prompter)
                return NS_ERROR_NOT_INITIALIZED;

            nsXPIDLString user, passwd;
            PRBool retval;
            nsCAutoString prePath;
            rv = mURL->GetPrePath(prePath);
            if (NS_FAILED(rv)) return rv;
            NS_ConvertUTF8toUCS2 prePathU(prePath);

            nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
            if (NS_FAILED(rv)) return rv;

            nsCOMPtr<nsIStringBundle> bundle;
            rv = bundleService->CreateBundle(NECKO_MSGS_URL, getter_AddRefs(bundle));
            if (NS_FAILED(rv)) return rv;
            
            nsXPIDLString formatedString;
            const PRUnichar *formatStrings[1] = { prePathU.get()};
            rv = bundle->FormatStringFromName(NS_LITERAL_STRING("EnterUserPasswordFor").get(),
                                              formatStrings, 1,
                                              getter_Copies(formatedString));                   
            rv = prompter->PromptUsernameAndPassword(nsnull,
                                                     formatedString,
                                                     prePathU.get(),
                                                     nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY,
                                                     getter_Copies(user), 
                                                     getter_Copies(passwd), 
                                                     &retval);

            // if the user canceled or didn't supply a username we want to fail
            if (!retval || (user && !*user) )
                return NS_ERROR_FAILURE;
            mUsername = user;
            mPassword = passwd;
        }
        // XXX Is UTF-8 the best choice?
        AppendUTF16toUTF8(mUsername, usernameStr);
    }
    usernameStr.Append(CRLF);

    return SendFTPCommand(usernameStr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsFtpState::SendFTPCommand ( nsCString command) [private]

Definition at line 2503 of file nsFtpConnectionThread.cpp.

{
    NS_ASSERTION(mControlConnection, "null control connection");        
    
    // we don't want to log the password:
    nsCAutoString logcmd(command);
    if (StringBeginsWith(command, NS_LITERAL_CSTRING("PASS "))) 
        logcmd = "PASS xxxxx";
    
    LOG(("(%x)(dwait=%d) Writing \"%s\"\n", this, mWaitingForDConn, logcmd.get()));

    nsCOMPtr<nsIFTPEventSink> ftpSink;
    mChannel->GetFTPEventSink(ftpSink);
    if (ftpSink)
        ftpSink->OnFTPControlLog(PR_FALSE, logcmd.get());
    
    if (mControlConnection) {
        return mControlConnection->Write(command, mWaitingForDConn);
    }
    return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1475 of file nsFtpConnectionThread.cpp.

Here is the caller graph for this function:

Definition at line 2313 of file nsFtpConnectionThread.cpp.

{
    if (!aInStream)
        return NS_OK;

    mAction = PUT;
    mWriteStream = aInStream;
    mWriteStream->Available(&mWriteCount);
    return NS_OK;
}

Here is the caller graph for this function:

Definition at line 2369 of file nsFtpConnectionThread.cpp.

{
    // Only do this function once.
    if (!mKeepRunning)
        return NS_OK;
    mKeepRunning = PR_FALSE;

    LOG_ALWAYS(("(%x) nsFtpState stopping", this));

#ifdef DEBUG_dougt
    printf("FTP Stopped: [response code %d] [response msg follows:]\n%s\n", mResponseCode, mResponseMsg.get());
#endif

    // We do this check here because the value of mInternalError changes during
    // this function. However, we only show the actual alert once we are done
    // changing member variables, because showing the dialog can process events
    // and we don't want to risk reentering this function. (compare bug 343371)
    nsCOMPtr<nsIPrompt> prompter;
    if (NS_FAILED(mInternalError) && !mResponseMsg.IsEmpty())
        mChannel->GetCallback(prompter);
   
    nsresult broadcastErrorCode = mControlStatus;
    if ( NS_SUCCEEDED(broadcastErrorCode))
        broadcastErrorCode = mInternalError;

    mInternalError = broadcastErrorCode;

    if (mDPipeRequest && NS_FAILED(broadcastErrorCode))
        mDPipeRequest->Cancel(broadcastErrorCode);
    
    if (mDRequestForwarder) {
        NS_RELEASE(mDRequestForwarder);
    }
    else
    {
        // The forwarding object was never created which  means that we never sent our notifications.
        
        nsCOMPtr<nsIRequestObserver> asyncObserver;

        NS_NewRequestObserverProxy(getter_AddRefs(asyncObserver), 
                                   mChannel,
                                   NS_CURRENT_EVENTQ);
        if(asyncObserver) {
            (void) asyncObserver->OnStartRequest(this, nsnull);
            (void) asyncObserver->OnStopRequest(this, nsnull, broadcastErrorCode);
        }


    }

    KillControlConnection();

    mChannel->OnStatus(nsnull, nsnull, NS_NET_STATUS_END_FTP_TRANSACTION, nsnull);

    // Release the Observers
    mWriteStream = 0;  // should this call close before setting to null?

    mChannel = 0;
    mProxyInfo = 0;

    // This code must be at the end of this function. See the comment about
    // prompter for why.
    if (prompter) 
    {
        // web shell wont throw an alert.  we better:

        // XXX(darin): this code should not be dictating UI like this!
        prompter->Alert(nsnull, NS_ConvertASCIItoUCS2(mResponseMsg).get());
    }
 
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIRequest::suspend ( ) [inherited]

Suspends the current request.

This may have the effect of closing any underlying transport (in order to free up resources), although any open streams remain logically opened and will continue delivering data when the transport is resumed.

NOTE: some implementations are unable to immediately suspend, and may continue to deliver events already posted to an event queue. In general, callers should be capable of handling events even after suspending a request.


Member Data Documentation

const unsigned long nsIRequest::INHIBIT_CACHING = 1 << 7 [inherited]

This flag prevents caching of any kind.

It does not, however, prevent cached content from being used to satisfy this request.

Definition at line 153 of file nsIRequest.idl.

const unsigned long nsIRequest::INHIBIT_PERSISTENT_CACHING = 1 << 8 [inherited]

This flag prevents caching on disk (or other persistent media), which may be needed to preserve privacy.

For HTTPS, this flag is set auto- matically.

Definition at line 160 of file nsIRequest.idl.

const unsigned long nsIRequest::LOAD_BACKGROUND = 1 << 0 [inherited]

Don't deliver status notifications to the nsIProgressEventSink, or keep this load from completing the nsILoadGroup it may belong to.

Definition at line 143 of file nsIRequest.idl.

const unsigned long nsIRequest::LOAD_BYPASS_CACHE = 1 << 9 [inherited]

Force an end-to-end download of content data from the origin server.

This flag is used for a shift-reload.

Definition at line 172 of file nsIRequest.idl.

const unsigned long nsIRequest::LOAD_FROM_CACHE = 1 << 10 [inherited]

Load from the cache, bypassing protocol specific validation logic.

This flag is used when browsing via history. It is not recommended for normal browsing as it may likely violate reasonable assumptions made by the server and confuse users.

Definition at line 180 of file nsIRequest.idl.

const unsigned long nsIRequest::LOAD_NORMAL = 0 [inherited]

No special load flags:

Definition at line 137 of file nsIRequest.idl.

The load flags of this request.

Bits 0-15 are reserved.

When added to a load group, this request's load flags are merged with the load flags of the load group.

Definition at line 128 of file nsIRequest.idl.

The load group of this request.

While pending, the request is a member of the load group. It is the responsibility of the request to implement this policy.

Definition at line 120 of file nsIRequest.idl.

Definition at line 209 of file nsFtpConnectionThread.h.

Definition at line 228 of file nsFtpConnectionThread.h.

Definition at line 210 of file nsFtpConnectionThread.h.

Definition at line 224 of file nsFtpConnectionThread.h.

Definition at line 223 of file nsFtpConnectionThread.h.

Definition at line 239 of file nsFtpConnectionThread.h.

Definition at line 199 of file nsFtpConnectionThread.h.

Definition at line 187 of file nsFtpConnectionThread.h.

Definition at line 237 of file nsFtpConnectionThread.h.

Definition at line 236 of file nsFtpConnectionThread.h.

Definition at line 192 of file nsFtpConnectionThread.h.

Definition at line 193 of file nsFtpConnectionThread.h.

Definition at line 194 of file nsFtpConnectionThread.h.

Definition at line 243 of file nsFtpConnectionThread.h.

Definition at line 217 of file nsFtpConnectionThread.h.

Definition at line 195 of file nsFtpConnectionThread.h.

Definition at line 212 of file nsFtpConnectionThread.h.

Definition at line 182 of file nsFtpConnectionThread.h.

Definition at line 204 of file nsFtpConnectionThread.h.

Definition at line 225 of file nsFtpConnectionThread.h.

Definition at line 196 of file nsFtpConnectionThread.h.

Definition at line 181 of file nsFtpConnectionThread.h.

Definition at line 208 of file nsFtpConnectionThread.h.

Definition at line 218 of file nsFtpConnectionThread.h.

Definition at line 216 of file nsFtpConnectionThread.h.

Definition at line 200 of file nsFtpConnectionThread.h.

Definition at line 219 of file nsFtpConnectionThread.h.

Definition at line 188 of file nsFtpConnectionThread.h.

Definition at line 183 of file nsFtpConnectionThread.h.

Definition at line 184 of file nsFtpConnectionThread.h.

Definition at line 191 of file nsFtpConnectionThread.h.

Definition at line 211 of file nsFtpConnectionThread.h.

char nsFtpState::mServerAddress[64] [private]

Definition at line 233 of file nsFtpConnectionThread.h.

Definition at line 229 of file nsFtpConnectionThread.h.

Definition at line 203 of file nsFtpConnectionThread.h.

Definition at line 231 of file nsFtpConnectionThread.h.

Definition at line 241 of file nsFtpConnectionThread.h.

Definition at line 180 of file nsFtpConnectionThread.h.

Definition at line 242 of file nsFtpConnectionThread.h.

Definition at line 222 of file nsFtpConnectionThread.h.

Definition at line 189 of file nsFtpConnectionThread.h.

Definition at line 215 of file nsFtpConnectionThread.h.

Definition at line 207 of file nsFtpConnectionThread.h.

Definition at line 190 of file nsFtpConnectionThread.h.

Definition at line 227 of file nsFtpConnectionThread.h.

Definition at line 226 of file nsFtpConnectionThread.h.

readonly attribute AUTF8String nsIRequest::name [inherited]

The name of the request.

Often this is the URI of the request.

Definition at line 55 of file nsIRequest.idl.

readonly attribute nsresult nsIRequest::status [inherited]

The error status associated with the request.

Definition at line 77 of file nsIRequest.idl.

const unsigned long nsIRequest::VALIDATE_ALWAYS = 1 << 11 [inherited]

The following flags control the frequency of cached content validation when neither LOAD_BYPASS_CACHE or LOAD_FROM_CACHE are set.

By default, cached content is automatically validated if necessary before reuse.

VALIDATE_ALWAYS forces validation of any cached content independent of its expiration time.

VALIDATE_NEVER disables validation of expired content.

VALIDATE_ONCE_PER_SESSION disables validation of expired content, provided it has already been validated (at least once) since the start of this session.

NOTE TO IMPLEMENTORS: These flags are intended for normal browsing, and they should therefore not apply to content that must be validated before each use. Consider, for example, a HTTP response with a "Cache-control: no-cache" header. According to RFC2616, this response must be validated before it can be taken from a cache. Breaking this requirement could result in incorrect and potentially undesirable side-effects.

Definition at line 204 of file nsIRequest.idl.

const unsigned long nsIRequest::VALIDATE_NEVER = 1 << 12 [inherited]

Definition at line 205 of file nsIRequest.idl.

const unsigned long nsIRequest::VALIDATE_ONCE_PER_SESSION = 1 << 13 [inherited]

Definition at line 206 of file nsIRequest.idl.


The documentation for this class was generated from the following files: