michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsHttpHandler_h__ michael@0: #define nsHttpHandler_h__ michael@0: michael@0: #include "nsHttp.h" michael@0: #include "nsHttpAuthCache.h" michael@0: #include "nsHttpConnectionMgr.h" michael@0: #include "ASpdySession.h" michael@0: michael@0: #include "nsString.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsWeakReference.h" michael@0: michael@0: #include "nsIHttpProtocolHandler.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsISpeculativeConnect.h" michael@0: #include "nsICache.h" michael@0: michael@0: class nsIHttpChannel; michael@0: class nsIPrefBranch; michael@0: class nsICancelable; michael@0: class nsICookieService; michael@0: class nsIIOService; michael@0: class nsIObserverService; michael@0: class nsISiteSecurityService; michael@0: class nsIStreamConverterService; michael@0: class nsITimer; michael@0: michael@0: namespace mozilla { michael@0: namespace net { michael@0: class ATokenBucketEvent; michael@0: class EventTokenBucket; michael@0: class Tickler; michael@0: class nsHttpConnection; michael@0: class nsHttpConnectionInfo; michael@0: class nsHttpTransaction; michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // nsHttpHandler - protocol handler for HTTP and HTTPS michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: class nsHttpHandler : public nsIHttpProtocolHandler michael@0: , public nsIObserver michael@0: , public nsSupportsWeakReference michael@0: , public nsISpeculativeConnect michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIPROTOCOLHANDLER michael@0: NS_DECL_NSIPROXIEDPROTOCOLHANDLER michael@0: NS_DECL_NSIHTTPPROTOCOLHANDLER michael@0: NS_DECL_NSIOBSERVER michael@0: NS_DECL_NSISPECULATIVECONNECT michael@0: michael@0: nsHttpHandler(); michael@0: virtual ~nsHttpHandler(); michael@0: michael@0: nsresult Init(); michael@0: nsresult AddStandardRequestHeaders(nsHttpHeaderArray *); michael@0: nsresult AddConnectionHeader(nsHttpHeaderArray *, michael@0: uint32_t capabilities); michael@0: bool IsAcceptableEncoding(const char *encoding); michael@0: michael@0: const nsAFlatCString &UserAgent(); michael@0: michael@0: nsHttpVersion HttpVersion() { return mHttpVersion; } michael@0: nsHttpVersion ProxyHttpVersion() { return mProxyHttpVersion; } michael@0: uint8_t ReferrerLevel() { return mReferrerLevel; } michael@0: bool SpoofReferrerSource() { return mSpoofReferrerSource; } michael@0: uint8_t ReferrerTrimmingPolicy() { return mReferrerTrimmingPolicy; } michael@0: uint8_t ReferrerXOriginPolicy() { return mReferrerXOriginPolicy; } michael@0: bool SendSecureXSiteReferrer() { return mSendSecureXSiteReferrer; } michael@0: uint8_t RedirectionLimit() { return mRedirectionLimit; } michael@0: PRIntervalTime IdleTimeout() { return mIdleTimeout; } michael@0: PRIntervalTime SpdyTimeout() { return mSpdyTimeout; } michael@0: PRIntervalTime ResponseTimeout() { michael@0: return mResponseTimeoutEnabled ? mResponseTimeout : 0; michael@0: } michael@0: PRIntervalTime ResponseTimeoutEnabled() { return mResponseTimeoutEnabled; } michael@0: uint16_t MaxRequestAttempts() { return mMaxRequestAttempts; } michael@0: const char *DefaultSocketType() { return mDefaultSocketType.get(); /* ok to return null */ } michael@0: uint32_t PhishyUserPassLength() { return mPhishyUserPassLength; } michael@0: uint8_t GetQoSBits() { return mQoSBits; } michael@0: uint16_t GetIdleSynTimeout() { return mIdleSynTimeout; } michael@0: bool FastFallbackToIPv4() { return mFastFallbackToIPv4; } michael@0: bool ProxyPipelining() { return mProxyPipelining; } michael@0: uint32_t MaxSocketCount(); michael@0: bool EnforceAssocReq() { return mEnforceAssocReq; } michael@0: michael@0: bool IsPersistentHttpsCachingEnabled() { return mEnablePersistentHttpsCaching; } michael@0: bool IsTelemetryEnabled() { return mTelemetryEnabled; } michael@0: bool AllowExperiments() { return mTelemetryEnabled && mAllowExperiments; } michael@0: michael@0: bool IsSpdyEnabled() { return mEnableSpdy; } michael@0: bool IsSpdyV3Enabled() { return mSpdyV3; } michael@0: bool IsSpdyV31Enabled() { return mSpdyV31; } michael@0: bool IsHttp2DraftEnabled() { return mHttp2DraftEnabled; } michael@0: bool EnforceHttp2TlsProfile() { return mEnforceHttp2TlsProfile; } michael@0: bool CoalesceSpdy() { return mCoalesceSpdy; } michael@0: bool UseSpdyPersistentSettings() { return mSpdyPersistentSettings; } michael@0: uint32_t SpdySendingChunkSize() { return mSpdySendingChunkSize; } michael@0: uint32_t SpdySendBufferSize() { return mSpdySendBufferSize; } michael@0: uint32_t SpdyPushAllowance() { return mSpdyPushAllowance; } michael@0: PRIntervalTime SpdyPingThreshold() { return mSpdyPingThreshold; } michael@0: PRIntervalTime SpdyPingTimeout() { return mSpdyPingTimeout; } michael@0: bool AllowPush() { return mAllowPush; } michael@0: uint32_t ConnectTimeout() { return mConnectTimeout; } michael@0: uint32_t ParallelSpeculativeConnectLimit() { return mParallelSpeculativeConnectLimit; } michael@0: bool CriticalRequestPrioritization() { return mCriticalRequestPrioritization; } michael@0: double BypassCacheLockThreshold() { return mBypassCacheLockThreshold; } michael@0: michael@0: bool UseRequestTokenBucket() { return mRequestTokenBucketEnabled; } michael@0: uint16_t RequestTokenBucketMinParallelism() { return mRequestTokenBucketMinParallelism; } michael@0: uint32_t RequestTokenBucketHz() { return mRequestTokenBucketHz; } michael@0: uint32_t RequestTokenBucketBurst() {return mRequestTokenBucketBurst; } michael@0: michael@0: bool PromptTempRedirect() { return mPromptTempRedirect; } michael@0: michael@0: // TCP Keepalive configuration values. michael@0: michael@0: // Returns true if TCP keepalive should be enabled for short-lived conns. michael@0: bool TCPKeepaliveEnabledForShortLivedConns() { michael@0: return mTCPKeepaliveShortLivedEnabled; michael@0: } michael@0: // Return time (secs) that a connection is consider short lived (for TCP michael@0: // keepalive purposes). After this time, the connection is long-lived. michael@0: int32_t GetTCPKeepaliveShortLivedTime() { michael@0: return mTCPKeepaliveShortLivedTimeS; michael@0: } michael@0: // Returns time (secs) before first TCP keepalive probes should be sent; michael@0: // same time used between successful keepalive probes. michael@0: int32_t GetTCPKeepaliveShortLivedIdleTime() { michael@0: return mTCPKeepaliveShortLivedIdleTimeS; michael@0: } michael@0: michael@0: // Returns true if TCP keepalive should be enabled for long-lived conns. michael@0: bool TCPKeepaliveEnabledForLongLivedConns() { michael@0: return mTCPKeepaliveLongLivedEnabled; michael@0: } michael@0: // Returns time (secs) before first TCP keepalive probes should be sent; michael@0: // same time used between successful keepalive probes. michael@0: int32_t GetTCPKeepaliveLongLivedIdleTime() { michael@0: return mTCPKeepaliveLongLivedIdleTimeS; michael@0: } michael@0: michael@0: nsHttpAuthCache *AuthCache(bool aPrivate) { michael@0: return aPrivate ? &mPrivateAuthCache : &mAuthCache; michael@0: } michael@0: nsHttpConnectionMgr *ConnMgr() { return mConnMgr; } michael@0: michael@0: // cache support michael@0: bool UseCache() const { return mUseCache; } michael@0: uint32_t GenerateUniqueID() { return ++mLastUniqueID; } michael@0: uint32_t SessionStartTime() { return mSessionStartTime; } michael@0: michael@0: // michael@0: // Connection management methods: michael@0: // michael@0: // - the handler only owns idle connections; it does not own active michael@0: // connections. michael@0: // michael@0: // - the handler keeps a count of active connections to enforce the michael@0: // steady-state max-connections pref. michael@0: // michael@0: michael@0: // Called to kick-off a new transaction, by default the transaction michael@0: // will be put on the pending transaction queue if it cannot be michael@0: // initiated at this time. Callable from any thread. michael@0: nsresult InitiateTransaction(nsHttpTransaction *trans, int32_t priority) michael@0: { michael@0: return mConnMgr->AddTransaction(trans, priority); michael@0: } michael@0: michael@0: // Called to change the priority of an existing transaction that has michael@0: // already been initiated. michael@0: nsresult RescheduleTransaction(nsHttpTransaction *trans, int32_t priority) michael@0: { michael@0: return mConnMgr->RescheduleTransaction(trans, priority); michael@0: } michael@0: michael@0: // Called to cancel a transaction, which may or may not be assigned to michael@0: // a connection. Callable from any thread. michael@0: nsresult CancelTransaction(nsHttpTransaction *trans, nsresult reason) michael@0: { michael@0: return mConnMgr->CancelTransaction(trans, reason); michael@0: } michael@0: michael@0: // Called when a connection is done processing a transaction. Callable michael@0: // from any thread. michael@0: nsresult ReclaimConnection(nsHttpConnection *conn) michael@0: { michael@0: return mConnMgr->ReclaimConnection(conn); michael@0: } michael@0: michael@0: nsresult ProcessPendingQ(nsHttpConnectionInfo *cinfo) michael@0: { michael@0: return mConnMgr->ProcessPendingQ(cinfo); michael@0: } michael@0: michael@0: nsresult ProcessPendingQ() michael@0: { michael@0: return mConnMgr->ProcessPendingQ(); michael@0: } michael@0: michael@0: nsresult GetSocketThreadTarget(nsIEventTarget **target) michael@0: { michael@0: return mConnMgr->GetSocketThreadTarget(target); michael@0: } michael@0: michael@0: nsresult SpeculativeConnect(nsHttpConnectionInfo *ci, michael@0: nsIInterfaceRequestor *callbacks, michael@0: uint32_t caps = 0) michael@0: { michael@0: TickleWifi(callbacks); michael@0: return mConnMgr->SpeculativeConnect(ci, callbacks, caps); michael@0: } michael@0: michael@0: // michael@0: // The HTTP handler caches pointers to specific XPCOM services, and michael@0: // provides the following helper routines for accessing those services: michael@0: // michael@0: nsresult GetStreamConverterService(nsIStreamConverterService **); michael@0: nsresult GetIOService(nsIIOService** service); michael@0: nsICookieService * GetCookieService(); // not addrefed michael@0: nsISiteSecurityService * GetSSService(); michael@0: michael@0: // callable from socket thread only michael@0: uint32_t Get32BitsOfPseudoRandom(); michael@0: michael@0: // Called by the channel synchronously during asyncOpen michael@0: void OnOpeningRequest(nsIHttpChannel *chan) michael@0: { michael@0: NotifyObservers(chan, NS_HTTP_ON_OPENING_REQUEST_TOPIC); michael@0: } michael@0: michael@0: // Called by the channel before writing a request michael@0: void OnModifyRequest(nsIHttpChannel *chan) michael@0: { michael@0: NotifyObservers(chan, NS_HTTP_ON_MODIFY_REQUEST_TOPIC); michael@0: } michael@0: michael@0: // Called by the channel once headers are available michael@0: void OnExamineResponse(nsIHttpChannel *chan) michael@0: { michael@0: NotifyObservers(chan, NS_HTTP_ON_EXAMINE_RESPONSE_TOPIC); michael@0: } michael@0: michael@0: // Called by the channel once headers have been merged with cached headers michael@0: void OnExamineMergedResponse(nsIHttpChannel *chan) michael@0: { michael@0: NotifyObservers(chan, NS_HTTP_ON_EXAMINE_MERGED_RESPONSE_TOPIC); michael@0: } michael@0: michael@0: // Called by channels before a redirect happens. This notifies both the michael@0: // channel's and the global redirect observers. michael@0: nsresult AsyncOnChannelRedirect(nsIChannel* oldChan, nsIChannel* newChan, michael@0: uint32_t flags); michael@0: michael@0: // Called by the channel when the response is read from the cache without michael@0: // communicating with the server. michael@0: void OnExamineCachedResponse(nsIHttpChannel *chan) michael@0: { michael@0: NotifyObservers(chan, NS_HTTP_ON_EXAMINE_CACHED_RESPONSE_TOPIC); michael@0: } michael@0: michael@0: // Generates the host:port string for use in the Host: header as well as the michael@0: // CONNECT line for proxies. This handles IPv6 literals correctly. michael@0: static nsresult GenerateHostPort(const nsCString& host, int32_t port, michael@0: nsCString& hostLine); michael@0: michael@0: bool GetPipelineAggressive() { return mPipelineAggressive; } michael@0: uint32_t GetMaxPipelinedRequests() { return mMaxPipelinedRequests; } michael@0: uint32_t GetMaxOptimisticPipelinedRequests() { return mMaxOptimisticPipelinedRequests; } michael@0: void GetMaxPipelineObjectSize(int64_t *outVal) michael@0: { michael@0: *outVal = mMaxPipelineObjectSize; michael@0: } michael@0: michael@0: bool GetPipelineEnabled() michael@0: { michael@0: return mCapabilities & NS_HTTP_ALLOW_PIPELINING; michael@0: } michael@0: michael@0: bool GetPipelineRescheduleOnTimeout() michael@0: { michael@0: return mPipelineRescheduleOnTimeout; michael@0: } michael@0: michael@0: PRIntervalTime GetPipelineRescheduleTimeout() michael@0: { michael@0: return mPipelineRescheduleTimeout; michael@0: } michael@0: michael@0: PRIntervalTime GetPipelineTimeout() { return mPipelineReadTimeout; } michael@0: michael@0: SpdyInformation *SpdyInfo() { return &mSpdyInfo; } michael@0: michael@0: // returns true in between Init and Shutdown states michael@0: bool Active() { return mHandlerActive; } michael@0: michael@0: static void GetCacheSessionNameForStoragePolicy( michael@0: nsCacheStoragePolicy storagePolicy, michael@0: bool isPrivate, michael@0: uint32_t appId, michael@0: bool inBrowser, michael@0: nsACString& sessionName); michael@0: michael@0: // When the disk cache is responding slowly its use is suppressed michael@0: // for 1 minute for most requests. Callable from main thread only. michael@0: TimeStamp GetCacheSkippedUntil() { return mCacheSkippedUntil; } michael@0: void SetCacheSkippedUntil(TimeStamp arg) { mCacheSkippedUntil = arg; } michael@0: void ClearCacheSkippedUntil() { mCacheSkippedUntil = TimeStamp(); } michael@0: michael@0: private: michael@0: michael@0: // michael@0: // Useragent/prefs helper methods michael@0: // michael@0: void BuildUserAgent(); michael@0: void InitUserAgentComponents(); michael@0: void PrefsChanged(nsIPrefBranch *prefs, const char *pref); michael@0: michael@0: nsresult SetAccept(const char *); michael@0: nsresult SetAcceptLanguages(const char *); michael@0: nsresult SetAcceptEncodings(const char *); michael@0: michael@0: nsresult InitConnectionMgr(); michael@0: michael@0: void NotifyObservers(nsIHttpChannel *chan, const char *event); michael@0: michael@0: static void TimerCallback(nsITimer * aTimer, void * aClosure); michael@0: private: michael@0: michael@0: // cached services michael@0: nsMainThreadPtrHandle mIOService; michael@0: nsMainThreadPtrHandle mStreamConvSvc; michael@0: nsMainThreadPtrHandle mObserverService; michael@0: nsMainThreadPtrHandle mCookieService; michael@0: nsMainThreadPtrHandle mSSService; michael@0: michael@0: // the authentication credentials cache michael@0: nsHttpAuthCache mAuthCache; michael@0: nsHttpAuthCache mPrivateAuthCache; michael@0: michael@0: // the connection manager michael@0: nsHttpConnectionMgr *mConnMgr; michael@0: michael@0: // michael@0: // prefs michael@0: // michael@0: michael@0: uint8_t mHttpVersion; michael@0: uint8_t mProxyHttpVersion; michael@0: uint32_t mCapabilities; michael@0: uint8_t mReferrerLevel; michael@0: uint8_t mSpoofReferrerSource; michael@0: uint8_t mReferrerTrimmingPolicy; michael@0: uint8_t mReferrerXOriginPolicy; michael@0: michael@0: bool mFastFallbackToIPv4; michael@0: bool mProxyPipelining; michael@0: PRIntervalTime mIdleTimeout; michael@0: PRIntervalTime mSpdyTimeout; michael@0: PRIntervalTime mResponseTimeout; michael@0: bool mResponseTimeoutEnabled; michael@0: michael@0: uint16_t mMaxRequestAttempts; michael@0: uint16_t mMaxRequestDelay; michael@0: uint16_t mIdleSynTimeout; michael@0: michael@0: bool mPipeliningEnabled; michael@0: uint16_t mMaxConnections; michael@0: uint8_t mMaxPersistentConnectionsPerServer; michael@0: uint8_t mMaxPersistentConnectionsPerProxy; michael@0: uint16_t mMaxPipelinedRequests; michael@0: uint16_t mMaxOptimisticPipelinedRequests; michael@0: bool mPipelineAggressive; michael@0: int64_t mMaxPipelineObjectSize; michael@0: bool mPipelineRescheduleOnTimeout; michael@0: PRIntervalTime mPipelineRescheduleTimeout; michael@0: PRIntervalTime mPipelineReadTimeout; michael@0: nsCOMPtr mPipelineTestTimer; michael@0: michael@0: uint8_t mRedirectionLimit; michael@0: michael@0: // we'll warn the user if we load an URL containing a userpass field michael@0: // unless its length is less than this threshold. this warning is michael@0: // intended to protect the user against spoofing attempts that use michael@0: // the userpass field of the URL to obscure the actual origin server. michael@0: uint8_t mPhishyUserPassLength; michael@0: michael@0: uint8_t mQoSBits; michael@0: michael@0: bool mPipeliningOverSSL; michael@0: bool mEnforceAssocReq; michael@0: michael@0: nsCString mAccept; michael@0: nsCString mAcceptLanguages; michael@0: nsCString mAcceptEncodings; michael@0: michael@0: nsXPIDLCString mDefaultSocketType; michael@0: michael@0: // cache support michael@0: uint32_t mLastUniqueID; michael@0: uint32_t mSessionStartTime; michael@0: michael@0: // useragent components michael@0: nsCString mLegacyAppName; michael@0: nsCString mLegacyAppVersion; michael@0: nsCString mPlatform; michael@0: nsCString mOscpu; michael@0: nsCString mMisc; michael@0: nsCString mProduct; michael@0: nsXPIDLCString mProductSub; michael@0: nsXPIDLCString mAppName; michael@0: nsXPIDLCString mAppVersion; michael@0: nsCString mCompatFirefox; michael@0: bool mCompatFirefoxEnabled; michael@0: nsXPIDLCString mCompatDevice; michael@0: michael@0: nsCString mUserAgent; michael@0: nsXPIDLCString mUserAgentOverride; michael@0: bool mUserAgentIsDirty; // true if mUserAgent should be rebuilt michael@0: michael@0: bool mUseCache; michael@0: michael@0: bool mPromptTempRedirect; michael@0: // mSendSecureXSiteReferrer: default is false, michael@0: // if true allow referrer headers between secure non-matching hosts michael@0: bool mSendSecureXSiteReferrer; michael@0: michael@0: // Persistent HTTPS caching flag michael@0: bool mEnablePersistentHttpsCaching; michael@0: michael@0: // For broadcasting tracking preference michael@0: bool mDoNotTrackEnabled; michael@0: uint8_t mDoNotTrackValue; michael@0: michael@0: // for broadcasting safe hint; michael@0: bool mSafeHintEnabled; michael@0: bool mParentalControlEnabled; michael@0: michael@0: // Whether telemetry is reported or not michael@0: uint32_t mTelemetryEnabled : 1; michael@0: michael@0: // The value of network.allow-experiments michael@0: uint32_t mAllowExperiments : 1; michael@0: michael@0: // true in between init and shutdown states michael@0: uint32_t mHandlerActive : 1; michael@0: michael@0: uint32_t mEnableSpdy : 1; michael@0: uint32_t mSpdyV3 : 1; michael@0: uint32_t mSpdyV31 : 1; michael@0: uint32_t mHttp2DraftEnabled : 1; michael@0: uint32_t mEnforceHttp2TlsProfile : 1; michael@0: uint32_t mCoalesceSpdy : 1; michael@0: uint32_t mSpdyPersistentSettings : 1; michael@0: uint32_t mAllowPush : 1; michael@0: michael@0: // Try to use SPDY features instead of HTTP/1.1 over SSL michael@0: SpdyInformation mSpdyInfo; michael@0: michael@0: uint32_t mSpdySendingChunkSize; michael@0: uint32_t mSpdySendBufferSize; michael@0: uint32_t mSpdyPushAllowance; michael@0: PRIntervalTime mSpdyPingThreshold; michael@0: PRIntervalTime mSpdyPingTimeout; michael@0: michael@0: // The maximum amount of time to wait for socket transport to be michael@0: // established. In milliseconds. michael@0: uint32_t mConnectTimeout; michael@0: michael@0: // The maximum amount of time the nsICacheSession lock can be held michael@0: // before a new transaction bypasses the cache. In milliseconds. michael@0: double mBypassCacheLockThreshold; michael@0: michael@0: // The maximum number of current global half open sockets allowable michael@0: // when starting a new speculative connection. michael@0: uint32_t mParallelSpeculativeConnectLimit; michael@0: michael@0: // For Rate Pacing of HTTP/1 requests through a netwerk/base/src/EventTokenBucket michael@0: // Active requests <= *MinParallelism are not subject to the rate pacing michael@0: bool mRequestTokenBucketEnabled; michael@0: uint16_t mRequestTokenBucketMinParallelism; michael@0: uint32_t mRequestTokenBucketHz; // EventTokenBucket HZ michael@0: uint32_t mRequestTokenBucketBurst; // EventTokenBucket Burst michael@0: michael@0: // Whether or not to block requests for non head js/css items (e.g. media) michael@0: // while those elements load. michael@0: bool mCriticalRequestPrioritization; michael@0: michael@0: // When the disk cache is responding slowly its use is suppressed michael@0: // for 1 minute for most requests. michael@0: TimeStamp mCacheSkippedUntil; michael@0: michael@0: // TCP Keepalive configuration values. michael@0: michael@0: // True if TCP keepalive is enabled for short-lived conns. michael@0: bool mTCPKeepaliveShortLivedEnabled; michael@0: // Time (secs) indicating how long a conn is considered short-lived. michael@0: int32_t mTCPKeepaliveShortLivedTimeS; michael@0: // Time (secs) before first keepalive probe; between successful probes. michael@0: int32_t mTCPKeepaliveShortLivedIdleTimeS; michael@0: michael@0: // True if TCP keepalive is enabled for long-lived conns. michael@0: bool mTCPKeepaliveLongLivedEnabled; michael@0: // Time (secs) before first keepalive probe; between successful probes. michael@0: int32_t mTCPKeepaliveLongLivedIdleTimeS; michael@0: michael@0: private: michael@0: // For Rate Pacing Certain Network Events. Only assign this pointer on michael@0: // socket thread. michael@0: void MakeNewRequestTokenBucket(); michael@0: nsRefPtr mRequestTokenBucket; michael@0: michael@0: public: michael@0: // Socket thread only michael@0: nsresult SubmitPacedRequest(ATokenBucketEvent *event, michael@0: nsICancelable **cancel) michael@0: { michael@0: if (!mRequestTokenBucket) michael@0: return NS_ERROR_UNEXPECTED; michael@0: return mRequestTokenBucket->SubmitEvent(event, cancel); michael@0: } michael@0: michael@0: // Socket thread only michael@0: void SetRequestTokenBucket(EventTokenBucket *aTokenBucket) michael@0: { michael@0: mRequestTokenBucket = aTokenBucket; michael@0: } michael@0: michael@0: private: michael@0: nsRefPtr mWifiTickler; michael@0: void TickleWifi(nsIInterfaceRequestor *cb); michael@0: }; michael@0: michael@0: extern nsHttpHandler *gHttpHandler; michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // nsHttpsHandler - thin wrapper to distinguish the HTTP handler from the michael@0: // HTTPS handler (even though they share the same impl). michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: class nsHttpsHandler : public nsIHttpProtocolHandler michael@0: , public nsSupportsWeakReference michael@0: , public nsISpeculativeConnect michael@0: { michael@0: public: michael@0: // we basically just want to override GetScheme and GetDefaultPort... michael@0: // all other methods should be forwarded to the nsHttpHandler instance. michael@0: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIPROTOCOLHANDLER michael@0: NS_FORWARD_NSIPROXIEDPROTOCOLHANDLER (gHttpHandler->) michael@0: NS_FORWARD_NSIHTTPPROTOCOLHANDLER (gHttpHandler->) michael@0: NS_FORWARD_NSISPECULATIVECONNECT (gHttpHandler->) michael@0: michael@0: nsHttpsHandler() { } michael@0: virtual ~nsHttpsHandler() { } michael@0: michael@0: nsresult Init(); michael@0: }; michael@0: michael@0: }} // namespace mozilla::net michael@0: michael@0: #endif // nsHttpHandler_h__