Back to index

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

#include <nsHttpConnectionInfo.h>

Collaboration diagram for nsHttpConnectionInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsHttpConnectionInfo (const nsACString &host, PRInt32 port, nsProxyInfo *proxyInfo, PRBool usingSSL=PR_FALSE)
 ~nsHttpConnectionInfo ()
nsrefcnt AddRef ()
nsrefcnt Release ()
const nsAFlatCStringHashKey () const
void SetOriginServer (const nsACString &host, PRInt32 port)
void SetOriginServer (const char *host, PRInt32 port)
const char * ProxyHost () const
PRInt32 ProxyPort () const
const char * ProxyType () const
PRBool Equals (const nsHttpConnectionInfo *info)
const char * Host () const
PRInt32 Port () const
nsProxyInfoProxyInfo ()
PRBool UsingHttpProxy () const
PRBool UsingSSL () const
PRInt32 DefaultPort () const

Private Attributes

nsrefcnt mRef
nsCString mHashKey
nsCString mHost
PRInt32 mPort
nsCOMPtr< nsProxyInfomProxyInfo
PRPackedBool mUsingHttpProxy
PRPackedBool mUsingSSL

Detailed Description

Definition at line 54 of file nsHttpConnectionInfo.h.


Constructor & Destructor Documentation

nsHttpConnectionInfo::nsHttpConnectionInfo ( const nsACString &  host,
PRInt32  port,
nsProxyInfo proxyInfo,
PRBool  usingSSL = PR_FALSE 
) [inline]

Definition at line 57 of file nsHttpConnectionInfo.h.

        : mRef(0)
        , mProxyInfo(proxyInfo)
        , mUsingSSL(usingSSL) 
    {
        LOG(("Creating nsHttpConnectionInfo @%x\n", this));

        mUsingHttpProxy = (proxyInfo && !nsCRT::strcmp(proxyInfo->Type(), "http"));

        SetOriginServer(host, port);
    }

Here is the call graph for this function:

Definition at line 71 of file nsHttpConnectionInfo.h.

    {
        LOG(("Destroying nsHttpConnectionInfo @%x\n", this));
    }

Member Function Documentation

Definition at line 76 of file nsHttpConnectionInfo.h.

    {
        return PR_AtomicIncrement((PRInt32 *) &mRef);
    }

Here is the call graph for this function:

Definition at line 119 of file nsHttpConnectionInfo.h.

Here is the caller graph for this function:

Definition at line 109 of file nsHttpConnectionInfo.h.

    {
        return mHashKey.Equals(info->HashKey());
    }

Here is the call graph for this function:

Definition at line 89 of file nsHttpConnectionInfo.h.

{ return mHashKey; }

Here is the caller graph for this function:

const char* nsHttpConnectionInfo::Host ( ) const [inline]

Definition at line 114 of file nsHttpConnectionInfo.h.

{ return mHost.get(); }

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsHttpConnectionInfo::Port ( ) const [inline]

Definition at line 115 of file nsHttpConnectionInfo.h.

{ return mPort; }

Here is the caller graph for this function:

const char* nsHttpConnectionInfo::ProxyHost ( ) const [inline]

Definition at line 98 of file nsHttpConnectionInfo.h.

{ return mProxyInfo ? mProxyInfo->Host().get() : nsnull; }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 116 of file nsHttpConnectionInfo.h.

{ return mProxyInfo; }

Here is the caller graph for this function:

Definition at line 99 of file nsHttpConnectionInfo.h.

{ return mProxyInfo ? mProxyInfo->Port() : -1; }

Here is the caller graph for this function:

const char* nsHttpConnectionInfo::ProxyType ( ) const [inline]

Definition at line 100 of file nsHttpConnectionInfo.h.

{ return mProxyInfo ? mProxyInfo->Type() : nsnull; }

Here is the caller graph for this function:

Definition at line 81 of file nsHttpConnectionInfo.h.

    {
        nsrefcnt n = PR_AtomicDecrement((PRInt32 *) &mRef);
        if (n == 0)
            delete this;
        return n;
    }

Here is the call graph for this function:

void nsHttpConnectionInfo::SetOriginServer ( const nsACString &  host,
PRInt32  port 
)

Definition at line 43 of file nsHttpConnectionInfo.cpp.

{
    mHost = host;
    mPort = port == -1 ? DefaultPort() : port;

    //
    // build hash key:
    //
    // the hash key uniquely identifies the connection type.  two connections
    // are "equal" if they end up talking the same protocol to the same server.
    //

    const char *keyHost;
    PRInt32 keyPort;

    if (mUsingHttpProxy && !mUsingSSL) {
        keyHost = ProxyHost();
        keyPort = ProxyPort();
    }
    else {
        keyHost = Host();
        keyPort = Port();
    }

    mHashKey.AssignLiteral("..");
    mHashKey.Append(keyHost);
    mHashKey.Append(':');
    mHashKey.AppendInt(keyPort);

    if (mUsingHttpProxy)
        mHashKey.SetCharAt('P', 0);
    if (mUsingSSL)
        mHashKey.SetCharAt('S', 1);

    // NOTE: for transparent proxies (e.g., SOCKS) we need to encode the proxy
    // type in the hash key (this ensures that we will continue to speak the
    // right protocol even if our proxy preferences change).
    if (!mUsingHttpProxy && ProxyHost()) {
        mHashKey.AppendLiteral(" (");
        mHashKey.Append(ProxyType());
        mHashKey.Append(')');
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsHttpConnectionInfo::SetOriginServer ( const char *  host,
PRInt32  port 
) [inline]

Definition at line 93 of file nsHttpConnectionInfo.h.

Here is the call graph for this function:

Definition at line 117 of file nsHttpConnectionInfo.h.

{ return mUsingHttpProxy; }

Here is the caller graph for this function:

Definition at line 118 of file nsHttpConnectionInfo.h.

{ return mUsingSSL; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 123 of file nsHttpConnectionInfo.h.

Definition at line 124 of file nsHttpConnectionInfo.h.

Definition at line 125 of file nsHttpConnectionInfo.h.

Definition at line 126 of file nsHttpConnectionInfo.h.

Definition at line 122 of file nsHttpConnectionInfo.h.

Definition at line 127 of file nsHttpConnectionInfo.h.

Definition at line 128 of file nsHttpConnectionInfo.h.


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