Back to index

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

#include <nsHttpHandler.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIPROTOCOLHANDLER
NS_DECL_NSIPROXIEDPROTOCOLHANDLER
NS_DECL_NSIHTTPPROTOCOLHANDLER
NS_DECL_NSIOBSERVER 
nsHttpHandler ()
virtual ~nsHttpHandler ()
nsresult Init ()
nsresult AddStandardRequestHeaders (nsHttpHeaderArray *, PRUint8 capabilities, PRBool useProxy)
PRBool IsAcceptableEncoding (const char *encoding)
const nsAFlatCStringUserAgent ()
nsHttpVersion HttpVersion ()
nsHttpVersion ProxyHttpVersion ()
PRUint8 ReferrerLevel ()
PRBool SendSecureXSiteReferrer ()
PRUint8 RedirectionLimit ()
PRUint16 IdleTimeout ()
PRUint16 MaxRequestAttempts ()
const char * DefaultSocketType ()
nsIIDNServiceIDNConverter ()
PRUint32 PhishyUserPassLength ()
PRBool IsPersistentHttpsCachingEnabled ()
nsHttpAuthCacheAuthCache ()
nsHttpConnectionMgrConnMgr ()
nsresult GetCacheSession (nsCacheStoragePolicy, nsICacheSession **)
PRUint32 GenerateUniqueID ()
PRUint32 SessionStartTime ()
nsresult InitiateTransaction (nsHttpTransaction *trans, PRInt32 priority)
nsresult RescheduleTransaction (nsHttpTransaction *trans, PRInt32 priority)
nsresult CancelTransaction (nsHttpTransaction *trans, nsresult reason)
nsresult ReclaimConnection (nsHttpConnection *conn)
nsresult ProcessPendingQ (nsHttpConnectionInfo *cinfo)
nsresult GetSocketThreadEventTarget (nsIEventTarget **target)
nsresult GetCurrentEventQ (nsIEventQueue **)
nsresult GetStreamConverterService (nsIStreamConverterService **)
nsresult GetIOService (nsIIOService **service)
nsICookieServiceGetCookieService ()
void OnModifyRequest (nsIHttpChannel *chan)
void OnExamineResponse (nsIHttpChannel *chan)
void OnExamineMergedResponse (nsIHttpChannel *chan)
nsresult OnChannelRedirect (nsIChannel *oldChan, nsIChannel *newChan, PRUint32 flags)
nsIChannel newProxiedChannel (in nsIURI uri, in nsIProxyInfo proxyInfo)
 Create a new channel with the given proxyInfo.
nsIURI newURI (in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBaseURI)
 Makes a URI object that is suitable for loading by this protocol, where the URI string is given as an UTF-8 string.
nsIChannel newChannel (in nsIURI aURI)
 Constructs a new channel from the given URI for this protocol handler.
boolean allowPort (in long port, in string scheme)
 Allows a protocol to override blacklisted ports.
void observe (in nsISupports aSubject, in string aTopic, in wstring aData)
 Observe will be called when there is a notification for the topic |aTopic|.

Public Attributes

readonly attribute ACString userAgent
 Get the HTTP advertised user agent string.
readonly attribute ACString appName
 Get the application name.
readonly attribute ACString appVersion
 Get the application version string.
attribute ACString vendor
attribute ACString vendorSub
attribute ACString vendorComment
attribute ACString product
attribute ACString productSub
attribute ACString productComment
readonly attribute ACString platform
 Get the current platform.
readonly attribute ACString oscpu
 Get the current oscpu.
attribute ACString language
 Get the translation of the application.
attribute ACString misc
 Get/Set the application comment misc portion.
readonly attribute ACString scheme
 The scheme of this protocol (e.g., "file").
readonly attribute long defaultPort
 The default port is the port that this protocol normally uses.
readonly attribute unsigned long protocolFlags
 Returns the protocol specific flags (see flag definitions below).
const unsigned long URI_STD = 0
 standard full URI with authority component and concept of relative URIs (http, ftp, ...)
const unsigned long URI_NORELATIVE = (1<<0)
 no concept of relative URIs (about, javascript, finger, ...)
const unsigned long URI_NOAUTH = (1<<1)
 no authority component (file, ...)
const unsigned long ALLOWS_PROXY = (1<<2)
 This protocol handler can be proxied via a proxy (socks or http) (e.g., irc, smtp, http, etc.).
const unsigned long ALLOWS_PROXY_HTTP = (1<<3)
 This protocol handler can be proxied using a http proxy (e.g., http, ftp, etc.).

Private Member Functions

void BuildUserAgent ()
void InitUserAgentComponents ()
void PrefsChanged (nsIPrefBranch *prefs, const char *pref)
nsresult SetAccept (const char *)
nsresult SetAcceptLanguages (const char *)
nsresult SetAcceptEncodings (const char *)
nsresult SetAcceptCharsets (const char *)
nsresult InitConnectionMgr ()
void StartPruneDeadConnectionsTimer ()
void StopPruneDeadConnectionsTimer ()
void NotifyObservers (nsIHttpChannel *chan, const char *event)

Private Attributes

nsCOMPtr< nsIIOServicemIOService
nsCOMPtr< nsIEventQueueServicemEventQueueService
nsCOMPtr
< nsIStreamConverterService
mStreamConvSvc
nsCOMPtr< nsIObserverServicemObserverService
nsCOMPtr< nsICookieServicemCookieService
nsCOMPtr< nsIIDNServicemIDNConverter
nsCOMPtr< nsITimermTimer
nsHttpAuthCache mAuthCache
nsHttpConnectionMgrmConnMgr
PRUint8 mHttpVersion
PRUint8 mProxyHttpVersion
PRUint8 mCapabilities
PRUint8 mProxyCapabilities
PRUint8 mReferrerLevel
PRUint16 mIdleTimeout
PRUint16 mMaxRequestAttempts
PRUint16 mMaxRequestDelay
PRUint16 mMaxConnections
PRUint8 mMaxConnectionsPerServer
PRUint8 mMaxPersistentConnectionsPerServer
PRUint8 mMaxPersistentConnectionsPerProxy
PRUint8 mMaxPipelinedRequests
PRUint8 mRedirectionLimit
PRUint8 mPhishyUserPassLength
nsCString mAccept
nsCString mAcceptLanguages
nsCString mAcceptEncodings
nsCString mAcceptCharsets
nsXPIDLCString mDefaultSocketType
nsCOMPtr< nsICacheSessionmCacheSession_ANY
nsCOMPtr< nsICacheSessionmCacheSession_MEM
PRUint32 mLastUniqueID
PRUint32 mSessionStartTime
nsXPIDLCString mAppName
nsXPIDLCString mAppVersion
nsCString mPlatform
nsCString mOscpu
nsXPIDLCString mSecurity
nsCString mLanguage
nsCString mMisc
nsXPIDLCString mVendor
nsXPIDLCString mVendorSub
nsXPIDLCString mVendorComment
nsXPIDLCString mProduct
nsXPIDLCString mProductSub
nsXPIDLCString mProductComment
nsCString mExtraUA
nsCString mUserAgent
nsXPIDLCString mUserAgentOverride
PRPackedBool mUserAgentIsDirty
PRPackedBool mUseCache
PRPackedBool mSendSecureXSiteReferrer
PRPackedBool mEnablePersistentHttpsCaching

Detailed Description

Definition at line 77 of file nsHttpHandler.h.


Constructor & Destructor Documentation

Definition at line 178 of file nsHttpHandler.cpp.

{
    // We do not deal with the timer cancellation in the destructor since
    // it is taken care of in xpcom shutdown event in the Observe method.

    LOG(("Deleting nsHttpHandler [this=%x]\n", this));

    // make sure the connection manager is shutdown
    if (mConnMgr) {
        mConnMgr->Shutdown();
        NS_RELEASE(mConnMgr);
    }

    nsHttp::DestroyAtomTable();

    gHttpHandler = nsnull;
}

Here is the call graph for this function:


Member Function Documentation

nsresult nsHttpHandler::AddStandardRequestHeaders ( nsHttpHeaderArray request,
PRUint8  capabilities,
PRBool  useProxy 
)

Definition at line 323 of file nsHttpHandler.cpp.

{
    nsresult rv;

    LOG(("nsHttpHandler::AddStandardRequestHeaders\n"));

    // Add the "User-Agent" header
    rv = request->SetHeader(nsHttp::User_Agent, UserAgent());
    if (NS_FAILED(rv)) return rv;

    // MIME based content negotiation lives!
    // Add the "Accept" header
    rv = request->SetHeader(nsHttp::Accept, mAccept);
    if (NS_FAILED(rv)) return rv;

    // Add the "Accept-Language" header
    if (!mAcceptLanguages.IsEmpty()) {
        // Add the "Accept-Language" header
        rv = request->SetHeader(nsHttp::Accept_Language, mAcceptLanguages);
        if (NS_FAILED(rv)) return rv;
    }

    // Add the "Accept-Encoding" header
    rv = request->SetHeader(nsHttp::Accept_Encoding, mAcceptEncodings);
    if (NS_FAILED(rv)) return rv;

    // Add the "Accept-Charset" header
    rv = request->SetHeader(nsHttp::Accept_Charset, mAcceptCharsets);
    if (NS_FAILED(rv)) return rv;

    // RFC2616 section 19.6.2 states that the "Connection: keep-alive"
    // and "Keep-alive" request headers should not be sent by HTTP/1.1
    // user-agents.  Otherwise, problems with proxy servers (especially
    // transparent proxies) can result.
    //
    // However, we need to send something so that we can use keepalive
    // with HTTP/1.0 servers/proxies. We use "Proxy-Connection:" when 
    // we're talking to an http proxy, and "Connection:" otherwise
    
    NS_NAMED_LITERAL_CSTRING(close, "close");
    NS_NAMED_LITERAL_CSTRING(keepAlive, "keep-alive");

    const nsACString *connectionType = &close;
    if (caps & NS_HTTP_ALLOW_KEEPALIVE) {
        rv = request->SetHeader(nsHttp::Keep_Alive, nsPrintfCString("%u", mIdleTimeout));
        if (NS_FAILED(rv)) return rv;
        connectionType = &keepAlive;
    } else if (useProxy) {
        // Bug 92006
        request->SetHeader(nsHttp::Connection, close);
    }

    const nsHttpAtom &header = useProxy ? nsHttp::Proxy_Connection
                                        : nsHttp::Connection;
    return request->SetHeader(header, *connectionType);
}

Here is the call graph for this function:

boolean nsIProtocolHandler::allowPort ( in long  port,
in string  scheme 
) [inherited]

Allows a protocol to override blacklisted ports.

This method will be called when there is an attempt to connect to a port that is blacklisted. For example, for most protocols, port 25 (Simple Mail Transfer) is banned. When a URI containing this "known-to-do-bad-things" port number is encountered, this function will be called to ask if the protocol handler wants to override the ban.

Definition at line 112 of file nsHttpHandler.h.

{ return &mAuthCache; }

Here is the caller graph for this function:

Definition at line 527 of file nsHttpHandler.cpp.

{
    LOG(("nsHttpHandler::BuildUserAgent\n"));

    NS_ASSERTION(!mAppName.IsEmpty() &&
                 !mAppVersion.IsEmpty() &&
                 !mPlatform.IsEmpty() &&
                 !mSecurity.IsEmpty() &&
                 !mOscpu.IsEmpty(),
                 "HTTP cannot send practical requests without this much");

    // preallocate to worst-case size, which should always be better
    // than if we didn't preallocate at all.
    mUserAgent.SetCapacity(mAppName.Length() + 
                           mAppVersion.Length() + 
                           mPlatform.Length() + 
                           mSecurity.Length() +
                           mOscpu.Length() +
                           mLanguage.Length() +
                           mMisc.Length() +
                           mProduct.Length() +
                           mProductSub.Length() +
                           mProductComment.Length() +
                           mVendor.Length() +
                           mVendorSub.Length() +
                           mVendorComment.Length() +
                           mExtraUA.Length() +
                           22);

    // Application portion
    mUserAgent.Assign(mAppName);
    mUserAgent += '/';
    mUserAgent += mAppVersion;
    mUserAgent += ' ';

    // Application comment
    mUserAgent += '(';
    mUserAgent += mPlatform;
    mUserAgent.AppendLiteral("; ");
    mUserAgent += mSecurity;
    mUserAgent.AppendLiteral("; ");
    mUserAgent += mOscpu;
    if (!mLanguage.IsEmpty()) {
        mUserAgent.AppendLiteral("; ");
        mUserAgent += mLanguage;
    }
    if (!mMisc.IsEmpty()) {
        mUserAgent.AppendLiteral("; ");
        mUserAgent += mMisc;
    }
    mUserAgent += ')';

    // Product portion
    if (!mProduct.IsEmpty()) {
        mUserAgent += ' ';
        mUserAgent += mProduct;
        if (!mProductSub.IsEmpty()) {
            mUserAgent += '/';
            mUserAgent += mProductSub;
        }
        if (!mProductComment.IsEmpty()) {
            mUserAgent.AppendLiteral(" (");
            mUserAgent += mProductComment;
            mUserAgent += ')';
        }
    }

    // Vendor portion
    if (!mVendor.IsEmpty()) {
        mUserAgent += ' ';
        mUserAgent += mVendor;
        if (!mVendorSub.IsEmpty()) {
            mUserAgent += '/';
            mUserAgent += mVendorSub;
        }
        if (!mVendorComment.IsEmpty()) {
            mUserAgent.AppendLiteral(" (");
            mUserAgent += mVendorComment;
            mUserAgent += ')';
        }
    }

    if (!mExtraUA.IsEmpty())
        mUserAgent += mExtraUA;
}

Here is the caller graph for this function:

Definition at line 147 of file nsHttpHandler.h.

    {
        return mConnMgr->CancelTransaction(trans, reason);
    }

Here is the call graph for this function:

Definition at line 113 of file nsHttpHandler.h.

{ return mConnMgr; }

Definition at line 106 of file nsHttpHandler.h.

{ return mDefaultSocketType.get(); /* ok to return null */ }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 117 of file nsHttpHandler.h.

{ return ++mLastUniqueID; }

Here is the caller graph for this function:

Definition at line 399 of file nsHttpHandler.cpp.

{
    nsresult rv;

    // Skip cache if disabled in preferences
    if (!mUseCache)
        return NS_ERROR_NOT_AVAILABLE;

    if (!mCacheSession_ANY) {
        nsCOMPtr<nsICacheService> serv = do_GetService(kCacheServiceCID, &rv);
        if (NS_FAILED(rv)) return rv;

        rv = serv->CreateSession("HTTP",
                                 nsICache::STORE_ANYWHERE,
                                 nsICache::STREAM_BASED,
                                 getter_AddRefs(mCacheSession_ANY));
        if (NS_FAILED(rv)) return rv;

        rv = mCacheSession_ANY->SetDoomEntriesIfExpired(PR_FALSE);
        if (NS_FAILED(rv)) return rv;

        rv = serv->CreateSession("HTTP-memory-only",
                                 nsICache::STORE_IN_MEMORY,
                                 nsICache::STREAM_BASED,
                                 getter_AddRefs(mCacheSession_MEM));
        if (NS_FAILED(rv)) return rv;

        rv = mCacheSession_MEM->SetDoomEntriesIfExpired(PR_FALSE);
        if (NS_FAILED(rv)) return rv;
    }

    if (storagePolicy == nsICache::STORE_IN_MEMORY)
        NS_ADDREF(*result = mCacheSession_MEM);
    else
        NS_ADDREF(*result = mCacheSession_ANY);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 464 of file nsHttpHandler.cpp.

{
    if (!mCookieService)
        mCookieService = do_GetService(kCookieServiceCID);
    return mCookieService;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 440 of file nsHttpHandler.cpp.

{
    if (!mEventQueueService) {
        nsresult rv;
        mEventQueueService = do_GetService(kEventQueueServiceCID, &rv);
        if (NS_FAILED(rv)) return rv;
    }
    return mEventQueueService->ResolveEventQueue(NS_CURRENT_EVENTQ, result);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 472 of file nsHttpHandler.cpp.

{
    NS_ADDREF(*result = mIOService);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 164 of file nsHttpHandler.h.

    {
        return mConnMgr->GetSocketThreadEventTarget(target);
    }

Here is the call graph for this function:

Definition at line 451 of file nsHttpHandler.cpp.

{
    if (!mStreamConvSvc) {
        nsresult rv;
        mStreamConvSvc = do_GetService(kStreamConverterServiceCID, &rv);
        if (NS_FAILED(rv)) return rv;
    }
    *result = mStreamConvSvc;
    NS_ADDREF(*result);
    return NS_OK;
}

Here is the call graph for this function:

Definition at line 99 of file nsHttpHandler.h.

{ return mHttpVersion; }

Here is the caller graph for this function:

Definition at line 104 of file nsHttpHandler.h.

{ return mIdleTimeout; }

Here is the caller graph for this function:

Definition at line 107 of file nsHttpHandler.h.

{ return mIDNConverter; }

Definition at line 197 of file nsHttpHandler.cpp.

{
    nsresult rv;

    LOG(("nsHttpHandler::Init\n"));

    rv = nsHttp::CreateAtomTable();
    if (NS_FAILED(rv))
        return rv;

    mIOService = do_GetService(kIOServiceCID, &rv);
    if (NS_FAILED(rv)) {
        NS_WARNING("unable to continue without io service");
        return rv;
    }

    InitUserAgentComponents();

    // monitor some preference changes
    nsCOMPtr<nsIPrefBranch2> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
    if (prefBranch) {
        prefBranch->AddObserver(HTTP_PREF_PREFIX, this, PR_TRUE);
        prefBranch->AddObserver(UA_PREF_PREFIX, this, PR_TRUE);
        prefBranch->AddObserver(INTL_ACCEPT_LANGUAGES, this, PR_TRUE); 
        prefBranch->AddObserver(INTL_ACCEPT_CHARSET, this, PR_TRUE);
        prefBranch->AddObserver(NETWORK_ENABLEIDN, this, PR_TRUE);
        prefBranch->AddObserver(BROWSER_PREF("disk_cache_ssl"), this, PR_TRUE);

        PrefsChanged(prefBranch, nsnull);
    }

    mMisc.AssignLiteral("rv:" MOZILLA_VERSION);

#if DEBUG
    // dump user agent prefs
    LOG(("> app-name = %s\n", mAppName.get()));
    LOG(("> app-version = %s\n", mAppVersion.get()));
    LOG(("> platform = %s\n", mPlatform.get()));
    LOG(("> oscpu = %s\n", mOscpu.get()));
    LOG(("> security = %s\n", mSecurity.get()));
    LOG(("> language = %s\n", mLanguage.get()));
    LOG(("> misc = %s\n", mMisc.get()));
    LOG(("> vendor = %s\n", mVendor.get()));
    LOG(("> vendor-sub = %s\n", mVendorSub.get()));
    LOG(("> vendor-comment = %s\n", mVendorComment.get()));
    LOG(("> extra = %s\n", mExtraUA.get()));
    LOG(("> product = %s\n", mProduct.get()));
    LOG(("> product-sub = %s\n", mProductSub.get()));
    LOG(("> product-comment = %s\n", mProductComment.get()));
    LOG(("> user-agent = %s\n", UserAgent().get()));
#endif

    mSessionStartTime = NowInSeconds();

    rv = mAuthCache.Init();
    if (NS_FAILED(rv)) return rv;

    rv = InitConnectionMgr();
    if (NS_FAILED(rv)) return rv;

    // Startup the http category
    // Bring alive the objects in the http-protocol-startup category
    NS_CreateServicesFromCategory(NS_HTTP_STARTUP_CATEGORY,
                                  NS_STATIC_CAST(nsISupports*,NS_STATIC_CAST(void*,this)),
                                  NS_HTTP_STARTUP_TOPIC);    
    
    mObserverService = do_GetService("@mozilla.org/observer-service;1");
    if (mObserverService) {
        mObserverService->AddObserver(this, "profile-change-net-teardown", PR_TRUE);
        mObserverService->AddObserver(this, "profile-change-net-restore", PR_TRUE);
        mObserverService->AddObserver(this, "session-logout", PR_TRUE);
        mObserverService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE);
    }
 
    StartPruneDeadConnectionsTimer();
    return NS_OK;
}

Here is the call graph for this function:

Definition at line 276 of file nsHttpHandler.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 133 of file nsHttpHandler.h.

    {
        return mConnMgr->AddTransaction(trans, priority);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 614 of file nsHttpHandler.cpp.

{

      // Gather platform.
    mPlatform.AssignLiteral(
#if defined(MOZ_WIDGET_PHOTON)
    "Photon"
#elif defined(XP_OS2)
    "OS/2"
#elif defined(XP_WIN)
    "Windows"
#elif defined(XP_MACOSX)
    "Macintosh"
#elif defined(XP_BEOS)
    "BeOS"
#elif !defined(MOZ_X11)
    "?"
#else
    "X11"
#endif
    );

    // Gather OS/CPU.
#if defined(XP_OS2)
    ULONG os2ver = 0;
    DosQuerySysInfo(QSV_VERSION_MINOR, QSV_VERSION_MINOR,
                    &os2ver, sizeof(os2ver));
    if (os2ver == 11)
        mOscpu.AssignLiteral("2.11");
    else if (os2ver == 30)
        mOscpu.AssignLiteral("Warp 3");
    else if (os2ver == 40)
        mOscpu.AssignLiteral("Warp 4");
    else if (os2ver == 45)
        mOscpu.AssignLiteral("Warp 4.5");

#elif defined(WINCE)
    OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
    if (GetVersionEx(&info)) {
        char *buf = PR_smprintf("Windows CE %ld.%ld",
                                info.dwMajorVersion,
                                info.dwMinorVersion);
        if (buf) {
            mOscpu = buf;
            PR_smprintf_free(buf);
        }
    }
#elif defined(XP_WIN)
    OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
    if (GetVersionEx(&info)) {
        if (info.dwPlatformId == VER_PLATFORM_WIN32_NT) {
            if (info.dwMajorVersion      == 3)
                mOscpu.AssignLiteral("WinNT3.51");
            else if (info.dwMajorVersion == 4)
                mOscpu.AssignLiteral("WinNT4.0");
            else {
                char *buf = PR_smprintf("Windows NT %ld.%ld",
                                        info.dwMajorVersion,
                                        info.dwMinorVersion);
                if (buf) {
                    mOscpu = buf;
                    PR_smprintf_free(buf);
                }
            }
        } else if (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS &&
                   info.dwMajorVersion == 4) {
            if (info.dwMinorVersion == 90)
                mOscpu.AssignLiteral("Win 9x 4.90");  // Windows Me
            else if (info.dwMinorVersion > 0)
                mOscpu.AssignLiteral("Win98");
            else
                mOscpu.AssignLiteral("Win95");
        } else {
            char *buf = PR_smprintf("Windows %ld.%ld",
                                    info.dwMajorVersion,
                                    info.dwMinorVersion);
            if (buf) {
                mOscpu = buf;
                PR_smprintf_free(buf);
            }
        }
    }
#elif defined (XP_MACOSX) && defined(__ppc__)
    mOscpu.AssignLiteral("PPC Mac OS X Mach-O");
#elif defined (XP_MACOSX) && defined(__i386__)
    mOscpu.AssignLiteral("Intel Mac OS X");
#elif defined (XP_UNIX) || defined (XP_BEOS)
    struct utsname name;
    
    int ret = uname(&name);
    if (ret >= 0) {
        nsCAutoString buf;
        buf =  (char*)name.sysname;

        if (strcmp(name.machine, "x86_64") == 0 &&
            sizeof(void *) == sizeof(PRInt32)) {
            // We're running 32-bit code on x86_64. Make this browser
            // look like it's running on i686 hardware, but append "
            // (x86_64)" to the end of the oscpu identifier to be able
            // to differentiate this from someone running 64-bit code
            // on x86_64..

            buf += " i686 (x86_64)";
        } else {
            buf += ' ';

#ifdef AIX
            // AIX uname returns machine specific info in the uname.machine
            // field and does not return the cpu type like other platforms.
            // We use the AIX version and release numbers instead.
            buf += (char*)name.version;
            buf += '.';
            buf += (char*)name.release;
#else
            buf += (char*)name.machine;
#endif
        }

        mOscpu.Assign(buf);
    }
#endif

    mUserAgentIsDirty = PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 383 of file nsHttpHandler.cpp.

{
    if (!enc)
        return PR_FALSE;

    // HTTP 1.1 allows servers to send x-gzip and x-compress instead
    // of gzip and compress, for example.  So, we'll always strip off
    // an "x-" prefix before matching the encoding to one we claim
    // to accept.
    if (!PL_strncasecmp(enc, "x-", 2))
        enc += 2;
    
    return PL_strcasestr(mAcceptEncodings.get(), enc) != nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 110 of file nsHttpHandler.h.

Here is the caller graph for this function:

Definition at line 105 of file nsHttpHandler.h.

{ return mMaxRequestAttempts; }

Here is the caller graph for this function:

Constructs a new channel from the given URI for this protocol handler.

Create a new channel with the given proxyInfo.

  
nsIURI nsIProtocolHandler::newURI ( in AUTF8String  aSpec,
in string  aOriginCharset,
in nsIURI  aBaseURI 
) [inherited]

Makes a URI object that is suitable for loading by this protocol, where the URI string is given as an UTF-8 string.

The caller may provide the charset from which the URI string originated, so that the URI string can be translated back to that charset (if necessary) before communicating with, for example, the origin server of the URI string. (Many servers do not support UTF-8 IRIs at the present time, so we must be careful about tracking the native charset of the origin server.)

Parameters:
aSpec- the URI string in UTF-8 encoding. depending on the protocol implementation, unicode character sequences may or may not be xx escaped.
aOriginCharset- the charset of the document from which this URI string originated. this corresponds to the charset that should be used when communicating this URI to an origin server, for example. if null, then UTF-8 encoding is assumed (i.e., no charset transformation from aSpec).
aBaseURI- if null, aSpec must specify an absolute URI. otherwise, aSpec may be resolved relative to aBaseURI, depending on the protocol. If the protocol has no concept of relative URI aBaseURI will simply be ignored.
void nsHttpHandler::NotifyObservers ( nsIHttpChannel chan,
const char *  event 
) [private]

Definition at line 480 of file nsHttpHandler.cpp.

{
    LOG(("nsHttpHandler::NotifyObservers [chan=%x event=\"%s\"]\n", chan, event));
    if (mObserverService)
        mObserverService->NotifyObservers(chan, event, nsnull);
}

Here is the caller graph for this function:

void nsIObserver::observe ( in nsISupports  aSubject,
in string  aTopic,
in wstring  aData 
) [inherited]

Observe will be called when there is a notification for the topic |aTopic|.

This assumes that the object implementing this interface has been registered with an observer service such as the nsIObserverService.

If you expect multiple topics/subjects, the impl is responsible for filtering.

You should not modify, add, remove, or enumerate notifications in the implemention of observe.

Parameters:
aSubject: Notification specific interface pointer.
aTopic: The notification topic or subject.
aData: Notification specific wide string. subject event.
nsresult nsHttpHandler::OnChannelRedirect ( nsIChannel oldChan,
nsIChannel newChan,
PRUint32  flags 
)

Definition at line 488 of file nsHttpHandler.cpp.

{
    // First, the global observer
    NS_ASSERTION(gIOService, "Must have an IO service at this point");
    nsresult rv = gIOService->OnChannelRedirect(oldChan, newChan, flags);
    if (NS_FAILED(rv))
        return rv;

    // Now, the per-channel observers
    nsCOMPtr<nsIChannelEventSink> sink;
    NS_QueryNotificationCallbacks(oldChan, sink);
    if (sink)
        rv = sink->OnChannelRedirect(oldChan, newChan, flags);

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 191 of file nsHttpHandler.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 185 of file nsHttpHandler.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 179 of file nsHttpHandler.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 108 of file nsHttpHandler.h.

Here is the caller graph for this function:

void nsHttpHandler::PrefsChanged ( nsIPrefBranch prefs,
const char *  pref 
) [private]

Definition at line 746 of file nsHttpHandler.cpp.

{
    nsresult rv = NS_OK;
    PRInt32 val;

    LOG(("nsHttpHandler::PrefsChanged [pref=%s]\n", pref));

#define PREF_CHANGED(p) ((pref == nsnull) || !PL_strcmp(pref, p))
#define MULTI_PREF_CHANGED(p) \
  ((pref == nsnull) || !PL_strncmp(pref, p, sizeof(p) - 1))

    //
    // UA components
    //

    // Gather application values.
    if (PREF_CHANGED(UA_PREF("appName"))) {
        prefs->GetCharPref(UA_PREF("appName"),
            getter_Copies(mAppName));
        if (mAppName.IsEmpty())
            mAppName.AssignLiteral(UA_APPNAME);
        mUserAgentIsDirty = PR_TRUE;
    }
    if (PREF_CHANGED(UA_PREF("appVersion"))) {
        prefs->GetCharPref(UA_PREF("appVersion"),
            getter_Copies(mAppVersion));
        if (mAppVersion.IsEmpty())
            mAppVersion.AssignLiteral(UA_APPVERSION);
        mUserAgentIsDirty = PR_TRUE;
    }

    // Gather vendor values.
    if (PREF_CHANGED(UA_PREF("vendor"))) {
        prefs->GetCharPref(UA_PREF("vendor"),
            getter_Copies(mVendor));
        mUserAgentIsDirty = PR_TRUE;
    }
    if (PREF_CHANGED(UA_PREF("vendorSub"))) {
        prefs->GetCharPref(UA_PREF("vendorSub"),
            getter_Copies(mVendorSub));
        mUserAgentIsDirty = PR_TRUE;
    }
    if (PREF_CHANGED(UA_PREF("vendorComment"))) {
        prefs->GetCharPref(UA_PREF("vendorComment"),
            getter_Copies(mVendorComment));
        mUserAgentIsDirty = PR_TRUE;
    }

    if (MULTI_PREF_CHANGED(UA_PREF("extra."))) {
        mExtraUA.Truncate();

        // Unfortunately, we can't do this using the pref branch.
        nsCOMPtr<nsIPrefService> service =
            do_GetService(NS_PREFSERVICE_CONTRACTID);
        nsCOMPtr<nsIPrefBranch> branch;
        service->GetBranch(UA_PREF("extra."), getter_AddRefs(branch));
        if (branch) {
            PRUint32 extraCount;
            char **extraItems;
            rv = branch->GetChildList("", &extraCount, &extraItems);
            if (NS_SUCCEEDED(rv) && extraItems) {
                NS_QuickSort(extraItems, extraCount, sizeof(extraItems[0]),
                             StringCompare, nsnull);
                for (char **item = extraItems,
                      **item_end = extraItems + extraCount;
                     item < item_end; ++item) {
                    nsXPIDLCString valStr;
                    branch->GetCharPref(*item, getter_Copies(valStr));
                    if (!valStr.IsEmpty())
                        mExtraUA += NS_LITERAL_CSTRING(" ") + valStr;
                }
                NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(extraCount, extraItems);
            }
        }

        mUserAgentIsDirty = PR_TRUE;
    }

    // Gather product values.
    if (PREF_CHANGED(UA_PREF("product"))) {
        prefs->GetCharPref(UA_PREF_PREFIX "product",
            getter_Copies(mProduct));
        mUserAgentIsDirty = PR_TRUE;
    }
    if (PREF_CHANGED(UA_PREF("productSub"))) {
        prefs->GetCharPref(UA_PREF("productSub"),
            getter_Copies(mProductSub));
        mUserAgentIsDirty = PR_TRUE;
    }
    if (PREF_CHANGED(UA_PREF("productComment"))) {
        prefs->GetCharPref(UA_PREF("productComment"),
            getter_Copies(mProductComment));
        mUserAgentIsDirty = PR_TRUE;
    }

    // Get Security level supported
    if (PREF_CHANGED(UA_PREF("security"))) {
        prefs->GetCharPref(UA_PREF("security"), getter_Copies(mSecurity));
        if (!mSecurity)
            mSecurity.AssignLiteral(UA_APPSECURITY_FALLBACK);
        mUserAgentIsDirty = PR_TRUE;
    }

    // Gather locale.
    if (PREF_CHANGED(UA_PREF("locale"))) {
        nsCOMPtr<nsIPrefLocalizedString> pls;
        prefs->GetComplexValue(UA_PREF("locale"),
                               NS_GET_IID(nsIPrefLocalizedString),
                               getter_AddRefs(pls));
        if (pls) {
            nsXPIDLString uval;
            pls->ToString(getter_Copies(uval));
            if (uval)
                CopyUTF16toUTF8(uval, mLanguage);
        }
        else {
            nsXPIDLCString cval;
            rv = prefs->GetCharPref(UA_PREF("locale"), getter_Copies(cval));
            if (cval)
                mLanguage.Assign(cval);
        }

        mUserAgentIsDirty = PR_TRUE;
    }

    // general.useragent.override
    if (PREF_CHANGED(UA_PREF("override"))) {
        prefs->GetCharPref(UA_PREF("override"),
                            getter_Copies(mUserAgentOverride));
        mUserAgentIsDirty = PR_TRUE;
    }

    //
    // HTTP options
    //

    if (PREF_CHANGED(HTTP_PREF("keep-alive.timeout"))) {
        rv = prefs->GetIntPref(HTTP_PREF("keep-alive.timeout"), &val);
        if (NS_SUCCEEDED(rv))
            mIdleTimeout = (PRUint16) CLAMP(val, 1, 0xffff);
    }

    if (PREF_CHANGED(HTTP_PREF("request.max-attempts"))) {
        rv = prefs->GetIntPref(HTTP_PREF("request.max-attempts"), &val);
        if (NS_SUCCEEDED(rv))
            mMaxRequestAttempts = (PRUint16) CLAMP(val, 1, 0xffff);
    }

    if (PREF_CHANGED(HTTP_PREF("request.max-start-delay"))) {
        rv = prefs->GetIntPref(HTTP_PREF("request.max-start-delay"), &val);
        if (NS_SUCCEEDED(rv)) {
            mMaxRequestDelay = (PRUint16) CLAMP(val, 0, 0xffff);
            if (mConnMgr)
                mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_REQUEST_DELAY,
                                      mMaxRequestDelay);
        }
    }

    if (PREF_CHANGED(HTTP_PREF("max-connections"))) {
        rv = prefs->GetIntPref(HTTP_PREF("max-connections"), &val);
        if (NS_SUCCEEDED(rv)) {
            mMaxConnections = (PRUint16) CLAMP(val, 1, 0xffff);
            if (mConnMgr)
                mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_CONNECTIONS,
                                      mMaxConnections);
        }
    }

    if (PREF_CHANGED(HTTP_PREF("max-connections-per-server"))) {
        rv = prefs->GetIntPref(HTTP_PREF("max-connections-per-server"), &val);
        if (NS_SUCCEEDED(rv)) {
            mMaxConnectionsPerServer = (PRUint8) CLAMP(val, 1, 0xff);
            if (mConnMgr) {
                mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_CONNECTIONS_PER_HOST,
                                      mMaxConnectionsPerServer);
                mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_CONNECTIONS_PER_PROXY,
                                      mMaxConnectionsPerServer);
            }
        }
    }

    if (PREF_CHANGED(HTTP_PREF("max-persistent-connections-per-server"))) {
        rv = prefs->GetIntPref(HTTP_PREF("max-persistent-connections-per-server"), &val);
        if (NS_SUCCEEDED(rv)) {
            mMaxPersistentConnectionsPerServer = (PRUint8) CLAMP(val, 1, 0xff);
            if (mConnMgr)
                mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_PERSISTENT_CONNECTIONS_PER_HOST,
                                      mMaxPersistentConnectionsPerServer);
        }
    }

    if (PREF_CHANGED(HTTP_PREF("max-persistent-connections-per-proxy"))) {
        rv = prefs->GetIntPref(HTTP_PREF("max-persistent-connections-per-proxy"), &val);
        if (NS_SUCCEEDED(rv)) {
            mMaxPersistentConnectionsPerProxy = (PRUint8) CLAMP(val, 1, 0xff);
            if (mConnMgr)
                mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_PERSISTENT_CONNECTIONS_PER_PROXY,
                                      mMaxPersistentConnectionsPerProxy);
        }
    }

    if (PREF_CHANGED(HTTP_PREF("sendRefererHeader"))) {
        rv = prefs->GetIntPref(HTTP_PREF("sendRefererHeader"), &val);
        if (NS_SUCCEEDED(rv))
            mReferrerLevel = (PRUint8) CLAMP(val, 0, 0xff);
    }

    if (PREF_CHANGED(HTTP_PREF("redirection-limit"))) {
        rv = prefs->GetIntPref(HTTP_PREF("redirection-limit"), &val);
        if (NS_SUCCEEDED(rv))
            mRedirectionLimit = (PRUint8) CLAMP(val, 0, 0xff);
    }

    if (PREF_CHANGED(HTTP_PREF("version"))) {
        nsXPIDLCString httpVersion;
        prefs->GetCharPref(HTTP_PREF("version"), getter_Copies(httpVersion));
        if (httpVersion) {
            if (!PL_strcmp(httpVersion, "1.1"))
                mHttpVersion = NS_HTTP_VERSION_1_1;
            else if (!PL_strcmp(httpVersion, "0.9"))
                mHttpVersion = NS_HTTP_VERSION_0_9;
            else
                mHttpVersion = NS_HTTP_VERSION_1_0;
        }
    }

    if (PREF_CHANGED(HTTP_PREF("proxy.version"))) {
        nsXPIDLCString httpVersion;
        prefs->GetCharPref(HTTP_PREF("proxy.version"), getter_Copies(httpVersion));
        if (httpVersion) {
            if (!PL_strcmp(httpVersion, "1.1"))
                mProxyHttpVersion = NS_HTTP_VERSION_1_1;
            else
                mProxyHttpVersion = NS_HTTP_VERSION_1_0;
            // it does not make sense to issue a HTTP/0.9 request to a proxy server
        }
    }

    PRBool cVar = PR_FALSE;

    if (PREF_CHANGED(HTTP_PREF("keep-alive"))) {
        rv = prefs->GetBoolPref(HTTP_PREF("keep-alive"), &cVar);
        if (NS_SUCCEEDED(rv)) {
            if (cVar)
                mCapabilities |= NS_HTTP_ALLOW_KEEPALIVE;
            else
                mCapabilities &= ~NS_HTTP_ALLOW_KEEPALIVE;
        }
    }

    if (PREF_CHANGED(HTTP_PREF("proxy.keep-alive"))) {
        rv = prefs->GetBoolPref(HTTP_PREF("proxy.keep-alive"), &cVar);
        if (NS_SUCCEEDED(rv)) {
            if (cVar)
                mProxyCapabilities |= NS_HTTP_ALLOW_KEEPALIVE;
            else
                mProxyCapabilities &= ~NS_HTTP_ALLOW_KEEPALIVE;
        }
    }

    if (PREF_CHANGED(HTTP_PREF("pipelining"))) {
        rv = prefs->GetBoolPref(HTTP_PREF("pipelining"), &cVar);
        if (NS_SUCCEEDED(rv)) {
            if (cVar)
                mCapabilities |=  NS_HTTP_ALLOW_PIPELINING;
            else
                mCapabilities &= ~NS_HTTP_ALLOW_PIPELINING;
        }
    }

    if (PREF_CHANGED(HTTP_PREF("pipelining.maxrequests"))) {
        rv = prefs->GetIntPref(HTTP_PREF("pipelining.maxrequests"), &val);
        if (NS_SUCCEEDED(rv)) {
            mMaxPipelinedRequests = CLAMP(val, 1, NS_HTTP_MAX_PIPELINED_REQUESTS);
            if (mConnMgr)
                mConnMgr->UpdateParam(nsHttpConnectionMgr::MAX_PIPELINED_REQUESTS,
                                      mMaxPipelinedRequests);
        }
    }

    if (PREF_CHANGED(HTTP_PREF("proxy.pipelining"))) {
        rv = prefs->GetBoolPref(HTTP_PREF("proxy.pipelining"), &cVar);
        if (NS_SUCCEEDED(rv)) {
            if (cVar)
                mProxyCapabilities |=  NS_HTTP_ALLOW_PIPELINING;
            else
                mProxyCapabilities &= ~NS_HTTP_ALLOW_PIPELINING;
        }
    }

    if (PREF_CHANGED(HTTP_PREF("sendSecureXSiteReferrer"))) {
        rv = prefs->GetBoolPref(HTTP_PREF("sendSecureXSiteReferrer"), &cVar);
        if (NS_SUCCEEDED(rv))
            mSendSecureXSiteReferrer = cVar;
    }

    if (PREF_CHANGED(HTTP_PREF("accept.default"))) {
        nsXPIDLCString accept;
        rv = prefs->GetCharPref(HTTP_PREF("accept.default"),
                                  getter_Copies(accept));
        if (NS_SUCCEEDED(rv))
            SetAccept(accept);
    }
    
    if (PREF_CHANGED(HTTP_PREF("accept-encoding"))) {
        nsXPIDLCString acceptEncodings;
        rv = prefs->GetCharPref(HTTP_PREF("accept-encoding"),
                                  getter_Copies(acceptEncodings));
        if (NS_SUCCEEDED(rv))
            SetAcceptEncodings(acceptEncodings);
    }

    if (PREF_CHANGED(HTTP_PREF("use-cache"))) {
        rv = prefs->GetBoolPref(HTTP_PREF("use-cache"), &cVar);
        if (NS_SUCCEEDED(rv)) {
            mUseCache = cVar;
            if (!mUseCache) {
                // release our references to the cache
                mCacheSession_ANY = 0;
                mCacheSession_MEM = 0;
            }
        }
    }

    if (PREF_CHANGED(HTTP_PREF("default-socket-type"))) {
        nsXPIDLCString sval;
        rv = prefs->GetCharPref(HTTP_PREF("default-socket-type"),
                                getter_Copies(sval));
        if (NS_SUCCEEDED(rv)) {
            if (sval.IsEmpty())
                mDefaultSocketType.Adopt(0);
            else {
                // verify that this socket type is actually valid
                nsCOMPtr<nsISocketProviderService> sps(
                        do_GetService(kSocketProviderServiceCID, &rv));
                if (NS_SUCCEEDED(rv)) {
                    nsCOMPtr<nsISocketProvider> sp;
                    rv = sps->GetSocketProvider(sval, getter_AddRefs(sp));
                    if (NS_SUCCEEDED(rv)) {
                        // OK, this looks like a valid socket provider.
                        mDefaultSocketType.Assign(sval);
                    }
                }
            }
        }
    }

    // enable Persistent caching for HTTPS - bug#205921    
    if (PREF_CHANGED(BROWSER_PREF("disk_cache_ssl"))) {
        cVar = PR_FALSE;
        rv = prefs->GetBoolPref(BROWSER_PREF("disk_cache_ssl"), &cVar);
        if (NS_SUCCEEDED(rv))
            mEnablePersistentHttpsCaching = cVar;
    }

    if (PREF_CHANGED(HTTP_PREF("phishy-userpass-length"))) {
        rv = prefs->GetIntPref(HTTP_PREF("phishy-userpass-length"), &val);
        if (NS_SUCCEEDED(rv))
            mPhishyUserPassLength = (PRUint8) CLAMP(val, 0, 0xff);
    }

    //
    // INTL options
    //

    if (PREF_CHANGED(INTL_ACCEPT_LANGUAGES)) {
        nsCOMPtr<nsIPrefLocalizedString> pls;
        prefs->GetComplexValue(INTL_ACCEPT_LANGUAGES,
                                NS_GET_IID(nsIPrefLocalizedString),
                                getter_AddRefs(pls));
        if (pls) {
            nsXPIDLString uval;
            pls->ToString(getter_Copies(uval));
            if (uval)
                SetAcceptLanguages(NS_ConvertUCS2toUTF8(uval).get());
        } 
    }

    if (PREF_CHANGED(INTL_ACCEPT_CHARSET)) {
        nsCOMPtr<nsIPrefLocalizedString> pls;
        prefs->GetComplexValue(INTL_ACCEPT_CHARSET,
                                NS_GET_IID(nsIPrefLocalizedString),
                                getter_AddRefs(pls));
        if (pls) {
            nsXPIDLString uval;
            pls->ToString(getter_Copies(uval));
            if (uval)
                SetAcceptCharsets(NS_ConvertUCS2toUTF8(uval).get());
        } 
    }

    //
    // IDN options
    //

    if (PREF_CHANGED(NETWORK_ENABLEIDN)) {
        PRBool enableIDN = PR_FALSE;
        prefs->GetBoolPref(NETWORK_ENABLEIDN, &enableIDN);
        // No locking is required here since this method runs in the main
        // UI thread, and so do all the methods in nsHttpChannel.cpp
        // (mIDNConverter is used by nsHttpChannel)
        if (enableIDN && !mIDNConverter) {
            mIDNConverter = do_GetService(NS_IDNSERVICE_CONTRACTID, &rv);
            NS_ASSERTION(NS_SUCCEEDED(rv), "idnSDK not installed");
        }
        else if (!enableIDN && mIDNConverter)
            mIDNConverter = nsnull;
    }

#undef PREF_CHANGED
#undef MULTI_PREF_CHANGED
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 159 of file nsHttpHandler.h.

    {
        return mConnMgr->ProcessPendingQ(cinfo);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 100 of file nsHttpHandler.h.

{ return mProxyHttpVersion; }

Here is the caller graph for this function:

Definition at line 154 of file nsHttpHandler.h.

    {
        return mConnMgr->ReclaimConnection(conn);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 103 of file nsHttpHandler.h.

{ return mRedirectionLimit; }

Definition at line 101 of file nsHttpHandler.h.

{ return mReferrerLevel; }

Definition at line 140 of file nsHttpHandler.h.

    {
        return mConnMgr->RescheduleTransaction(trans, priority);
    }

Here is the call graph for this function:

Definition at line 102 of file nsHttpHandler.h.

Definition at line 118 of file nsHttpHandler.h.

{ return mSessionStartTime; }

Here is the caller graph for this function:

nsresult nsHttpHandler::SetAccept ( const char *  aAccept) [private]

Definition at line 1375 of file nsHttpHandler.cpp.

{
    mAccept = aAccept;
    return NS_OK;
}

Here is the caller graph for this function:

nsresult nsHttpHandler::SetAcceptCharsets ( const char *  aAcceptCharsets) [private]

Definition at line 1365 of file nsHttpHandler.cpp.

{
    nsCString buf;
    nsresult rv = PrepareAcceptCharsets(aAcceptCharsets, buf);
    if (NS_SUCCEEDED(rv))
        mAcceptCharsets.Assign(buf);
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsHttpHandler::SetAcceptEncodings ( const char *  aAcceptEncodings) [private]

Definition at line 1382 of file nsHttpHandler.cpp.

{
    mAcceptEncodings = aAcceptEncodings;
    return NS_OK;
}

Here is the caller graph for this function:

nsresult nsHttpHandler::SetAcceptLanguages ( const char *  aAcceptLanguages) [private]

Definition at line 1235 of file nsHttpHandler.cpp.

{
    nsCAutoString buf;
    nsresult rv = PrepareAcceptLanguages(aAcceptLanguages, buf);
    if (NS_SUCCEEDED(rv))
        mAcceptLanguages.Assign(buf);
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 298 of file nsHttpHandler.cpp.

{
    LOG(("nsHttpHandler::StartPruneDeadConnectionsTimer\n"));

    mTimer = do_CreateInstance("@mozilla.org/timer;1");
    NS_ASSERTION(mTimer, "no timer");
    // failure to create a timer is not a fatal error, but idle connections
    // will not be cleaned up until we try to use them.
    if (mTimer)
        mTimer->Init(this, 15*1000, // every 15 seconds
                     nsITimer::TYPE_REPEATING_SLACK);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 312 of file nsHttpHandler.cpp.

{
    LOG(("nsHttpHandler::StopPruneDeadConnectionsTimer\n"));

    if (mTimer) {
        mTimer->Cancel();
        mTimer = 0;
    }
}

Definition at line 511 of file nsHttpHandler.cpp.

{
    if (mUserAgentOverride) {
        LOG(("using general.useragent.override : %s\n", mUserAgentOverride.get()));
        return mUserAgentOverride;
    }

    if (mUserAgentIsDirty) {
        BuildUserAgent();
        mUserAgentIsDirty = PR_FALSE;
    }

    return mUserAgent;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

const unsigned long nsIProtocolHandler::ALLOWS_PROXY = (1<<2) [inherited]

This protocol handler can be proxied via a proxy (socks or http) (e.g., irc, smtp, http, etc.).

If the protocol supports transparent proxying, the handler should implement nsIProxiedProtocolHandler.

If it supports only HTTP proxying, then it need not support nsIProxiedProtocolHandler, but should instead set the ALLOWS_PROXY_HTTP flag (see below).

See also:
nsIProxiedProtocolHandler

Definition at line 148 of file nsIProtocolHandler.idl.

const unsigned long nsIProtocolHandler::ALLOWS_PROXY_HTTP = (1<<3) [inherited]

This protocol handler can be proxied using a http proxy (e.g., http, ftp, etc.).

nsIIOService::newChannelFromURI will feed URIs from this protocol handler to the HTTP protocol handler instead. This flag is ignored if ALLOWS_PROXY is not set.

Definition at line 156 of file nsIProtocolHandler.idl.

readonly attribute ACString nsIHttpProtocolHandler::appName [inherited]

Get the application name.

Returns:
The name of this application (eg. "Mozilla").

Definition at line 55 of file nsIHttpProtocolHandler.idl.

readonly attribute ACString nsIHttpProtocolHandler::appVersion [inherited]

Get the application version string.

Returns:
The complete version (major and minor) string. (eg. "5.0")

Definition at line 62 of file nsIHttpProtocolHandler.idl.

The default port is the port that this protocol normally uses.

If a port does not make sense for the protocol (e.g., "about:") then -1 will be returned.

Definition at line 61 of file nsIProtocolHandler.idl.

Get the translation of the application.

The value for language is usually a 2-letter code such as "en" and occasionally a five-character code to indicate a language subtype, such as "zh_CN".

Definition at line 114 of file nsIHttpProtocolHandler.idl.

Definition at line 265 of file nsHttpHandler.h.

Definition at line 268 of file nsHttpHandler.h.

Definition at line 267 of file nsHttpHandler.h.

Definition at line 266 of file nsHttpHandler.h.

Definition at line 279 of file nsHttpHandler.h.

Definition at line 280 of file nsHttpHandler.h.

Definition at line 232 of file nsHttpHandler.h.

Definition at line 273 of file nsHttpHandler.h.

Definition at line 274 of file nsHttpHandler.h.

Definition at line 243 of file nsHttpHandler.h.

Definition at line 235 of file nsHttpHandler.h.

Definition at line 227 of file nsHttpHandler.h.

Definition at line 270 of file nsHttpHandler.h.

Definition at line 304 of file nsHttpHandler.h.

Definition at line 224 of file nsHttpHandler.h.

Definition at line 292 of file nsHttpHandler.h.

Definition at line 241 of file nsHttpHandler.h.

Definition at line 247 of file nsHttpHandler.h.

Definition at line 228 of file nsHttpHandler.h.

Definition at line 223 of file nsHttpHandler.h.

Get/Set the application comment misc portion.

Definition at line 119 of file nsIHttpProtocolHandler.idl.

Definition at line 284 of file nsHttpHandler.h.

Definition at line 275 of file nsHttpHandler.h.

Definition at line 251 of file nsHttpHandler.h.

Definition at line 252 of file nsHttpHandler.h.

Definition at line 254 of file nsHttpHandler.h.

Definition at line 253 of file nsHttpHandler.h.

Definition at line 255 of file nsHttpHandler.h.

Definition at line 248 of file nsHttpHandler.h.

Definition at line 249 of file nsHttpHandler.h.

Definition at line 285 of file nsHttpHandler.h.

Definition at line 226 of file nsHttpHandler.h.

Definition at line 282 of file nsHttpHandler.h.

Definition at line 263 of file nsHttpHandler.h.

Definition at line 281 of file nsHttpHandler.h.

Definition at line 289 of file nsHttpHandler.h.

Definition at line 291 of file nsHttpHandler.h.

Definition at line 290 of file nsHttpHandler.h.

Definition at line 244 of file nsHttpHandler.h.

Definition at line 242 of file nsHttpHandler.h.

Definition at line 257 of file nsHttpHandler.h.

Definition at line 245 of file nsHttpHandler.h.

Definition at line 283 of file nsHttpHandler.h.

Definition at line 301 of file nsHttpHandler.h.

Definition at line 276 of file nsHttpHandler.h.

Definition at line 225 of file nsHttpHandler.h.

Definition at line 229 of file nsHttpHandler.h.

Definition at line 298 of file nsHttpHandler.h.

Definition at line 294 of file nsHttpHandler.h.

Definition at line 296 of file nsHttpHandler.h.

Definition at line 295 of file nsHttpHandler.h.

Definition at line 286 of file nsHttpHandler.h.

Definition at line 288 of file nsHttpHandler.h.

Definition at line 287 of file nsHttpHandler.h.

readonly attribute ACString nsIHttpProtocolHandler::oscpu [inherited]

Get the current oscpu.

Returns:
The oscpu this application is running on

Definition at line 107 of file nsIHttpProtocolHandler.idl.

readonly attribute ACString nsIHttpProtocolHandler::platform [inherited]

Get the current platform.

Returns:
The platform this application is running on (eg. "Windows", "Macintosh", "X11")

Definition at line 100 of file nsIHttpProtocolHandler.idl.

Returns:
The product name.

Definition at line 82 of file nsIHttpProtocolHandler.idl.

Returns:
A product comment.

Definition at line 92 of file nsIHttpProtocolHandler.idl.

Returns:
A product sub string.

Definition at line 87 of file nsIHttpProtocolHandler.idl.

readonly attribute unsigned long nsIProtocolHandler::protocolFlags [inherited]

Returns the protocol specific flags (see flag definitions below).

Definition at line 66 of file nsIProtocolHandler.idl.

readonly attribute ACString nsIProtocolHandler::scheme [inherited]

The scheme of this protocol (e.g., "file").

Definition at line 54 of file nsIProtocolHandler.idl.

const unsigned long nsIProtocolHandler::URI_NOAUTH = (1<<1) [inherited]

no authority component (file, ...)

Definition at line 135 of file nsIProtocolHandler.idl.

const unsigned long nsIProtocolHandler::URI_NORELATIVE = (1<<0) [inherited]

no concept of relative URIs (about, javascript, finger, ...)

Definition at line 130 of file nsIProtocolHandler.idl.

const unsigned long nsIProtocolHandler::URI_STD = 0 [inherited]

standard full URI with authority component and concept of relative URIs (http, ftp, ...)

Definition at line 125 of file nsIProtocolHandler.idl.

readonly attribute ACString nsIHttpProtocolHandler::userAgent [inherited]

Get the HTTP advertised user agent string.

Definition at line 48 of file nsIHttpProtocolHandler.idl.

Returns:
The vendor name.

Definition at line 67 of file nsIHttpProtocolHandler.idl.

Returns:
The vendor comment.

Definition at line 77 of file nsIHttpProtocolHandler.idl.

Returns:
The vendor sub string.

Definition at line 72 of file nsIHttpProtocolHandler.idl.


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