2001-05-12 01:04:09 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-04-14 21:37:39 +04:00
|
|
|
/* vim:set et cin ts=4 sw=4 sts=4: */
|
2004-04-19 02:01:16 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
2001-05-12 01:04:09 +04:00
|
|
|
* The Original Code is Mozilla.
|
2004-04-19 02:01:16 +04:00
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2001-05-12 01:04:09 +04:00
|
|
|
* Darin Fisher <darin@netscape.com> (original author)
|
2006-03-04 00:06:53 +03:00
|
|
|
* Christian Biesinger <cbiesinger@web.de>
|
2010-04-07 12:43:09 +04:00
|
|
|
* Daniel Witte <dwitte@mozilla.com>
|
2010-06-23 04:33:57 +04:00
|
|
|
* Jason Duell <jduell.mcbugs@gmail.com>
|
2004-04-19 02:01:16 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-05-12 01:04:09 +04:00
|
|
|
|
|
|
|
#ifndef nsHttpChannel_h__
|
|
|
|
#define nsHttpChannel_h__
|
|
|
|
|
2010-04-07 12:43:09 +04:00
|
|
|
#include "HttpBaseChannel.h"
|
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
#include "nsHttpTransaction.h"
|
2006-03-04 00:06:53 +03:00
|
|
|
#include "nsInputStreamPump.h"
|
2006-05-10 21:30:15 +04:00
|
|
|
#include "nsThreadUtils.h"
|
2010-07-28 22:33:06 +04:00
|
|
|
#include "nsTArray.h"
|
2010-04-07 12:43:09 +04:00
|
|
|
|
2001-05-12 01:04:09 +04:00
|
|
|
#include "nsIHttpEventSink.h"
|
|
|
|
#include "nsICachingChannel.h"
|
|
|
|
#include "nsICacheEntryDescriptor.h"
|
|
|
|
#include "nsICacheListener.h"
|
2008-11-04 13:20:27 +03:00
|
|
|
#include "nsIApplicationCacheChannel.h"
|
2003-03-25 04:19:21 +03:00
|
|
|
#include "nsIPrompt.h"
|
2004-04-14 21:37:39 +04:00
|
|
|
#include "nsIResumableChannel.h"
|
2005-06-25 03:58:25 +04:00
|
|
|
#include "nsIProtocolProxyCallback.h"
|
|
|
|
#include "nsICancelable.h"
|
2010-06-17 22:33:42 +04:00
|
|
|
#include "nsIHttpAuthenticableChannel.h"
|
2008-08-25 21:21:28 +04:00
|
|
|
#include "nsITraceableChannel.h"
|
2010-06-17 22:33:42 +04:00
|
|
|
#include "nsIHttpChannelAuthProvider.h"
|
2010-07-28 22:33:06 +04:00
|
|
|
#include "nsIAsyncVerifyRedirectCallback.h"
|
2010-11-26 20:13:37 +03:00
|
|
|
#include "nsICryptoHash.h"
|
2011-05-21 14:03:36 +04:00
|
|
|
#include "nsITimedChannel.h"
|
|
|
|
#include "TimingStruct.h"
|
2002-10-01 03:18:43 +04:00
|
|
|
|
2003-03-26 08:05:49 +03:00
|
|
|
class nsAHttpConnection;
|
2010-06-04 01:03:17 +04:00
|
|
|
class AutoRedirectVetoNotifier;
|
2010-04-07 12:43:09 +04:00
|
|
|
|
|
|
|
using namespace mozilla::net;
|
2001-05-12 01:04:09 +04:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// nsHttpChannel
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2010-04-07 12:43:09 +04:00
|
|
|
class nsHttpChannel : public HttpBaseChannel
|
2001-05-12 01:04:09 +04:00
|
|
|
, public nsIStreamListener
|
|
|
|
, public nsICachingChannel
|
|
|
|
, public nsICacheListener
|
2003-01-18 05:15:14 +03:00
|
|
|
, public nsITransportEventSink
|
2005-06-25 03:58:25 +04:00
|
|
|
, public nsIProtocolProxyCallback
|
2010-06-17 22:33:42 +04:00
|
|
|
, public nsIHttpAuthenticableChannel
|
2008-08-25 21:21:28 +04:00
|
|
|
, public nsITraceableChannel
|
2008-11-04 13:20:27 +03:00
|
|
|
, public nsIApplicationCacheChannel
|
2010-07-28 22:33:06 +04:00
|
|
|
, public nsIAsyncVerifyRedirectCallback
|
2011-05-21 14:03:36 +04:00
|
|
|
, public nsITimedChannel
|
2001-05-12 01:04:09 +04:00
|
|
|
{
|
|
|
|
public:
|
2005-04-05 21:40:32 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2001-05-12 01:04:09 +04:00
|
|
|
NS_DECL_NSIREQUESTOBSERVER
|
|
|
|
NS_DECL_NSISTREAMLISTENER
|
2010-06-24 10:55:19 +04:00
|
|
|
NS_DECL_NSICACHEINFOCHANNEL
|
2001-05-12 01:04:09 +04:00
|
|
|
NS_DECL_NSICACHINGCHANNEL
|
|
|
|
NS_DECL_NSICACHELISTENER
|
2003-01-18 05:15:14 +03:00
|
|
|
NS_DECL_NSITRANSPORTEVENTSINK
|
2005-06-25 03:58:25 +04:00
|
|
|
NS_DECL_NSIPROTOCOLPROXYCALLBACK
|
2006-08-02 01:28:31 +04:00
|
|
|
NS_DECL_NSIPROXIEDCHANNEL
|
2008-08-25 21:21:28 +04:00
|
|
|
NS_DECL_NSITRACEABLECHANNEL
|
2008-08-27 03:09:02 +04:00
|
|
|
NS_DECL_NSIAPPLICATIONCACHECONTAINER
|
2008-11-04 13:20:27 +03:00
|
|
|
NS_DECL_NSIAPPLICATIONCACHECHANNEL
|
2010-07-28 22:33:06 +04:00
|
|
|
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
|
2011-05-21 14:03:36 +04:00
|
|
|
NS_DECL_NSITIMEDCHANNEL
|
2010-06-17 22:33:42 +04:00
|
|
|
|
|
|
|
// nsIHttpAuthenticableChannel. We can't use
|
|
|
|
// NS_DECL_NSIHTTPAUTHENTICABLECHANNEL because it duplicates cancel() and
|
|
|
|
// others.
|
|
|
|
NS_IMETHOD GetIsSSL(PRBool *aIsSSL);
|
|
|
|
NS_IMETHOD GetProxyMethodIsConnect(PRBool *aProxyMethodIsConnect);
|
|
|
|
NS_IMETHOD GetServerResponseHeader(nsACString & aServerResponseHeader);
|
|
|
|
NS_IMETHOD GetProxyChallenges(nsACString & aChallenges);
|
|
|
|
NS_IMETHOD GetWWWChallenges(nsACString & aChallenges);
|
|
|
|
NS_IMETHOD SetProxyCredentials(const nsACString & aCredentials);
|
|
|
|
NS_IMETHOD SetWWWCredentials(const nsACString & aCredentials);
|
|
|
|
NS_IMETHOD OnAuthAvailable();
|
|
|
|
NS_IMETHOD OnAuthCancelled(PRBool userCancel);
|
2010-06-23 04:33:57 +04:00
|
|
|
// Functions we implement from nsIHttpAuthenticableChannel but are
|
|
|
|
// declared in HttpBaseChannel must be implemented in this class. We
|
|
|
|
// just call the HttpBaseChannel:: impls.
|
|
|
|
NS_IMETHOD GetLoadFlags(nsLoadFlags *aLoadFlags);
|
|
|
|
NS_IMETHOD GetURI(nsIURI **aURI);
|
|
|
|
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor **aCallbacks);
|
|
|
|
NS_IMETHOD GetLoadGroup(nsILoadGroup **aLoadGroup);
|
|
|
|
NS_IMETHOD GetRequestMethod(nsACString& aMethod);
|
2001-05-12 01:04:09 +04:00
|
|
|
|
|
|
|
nsHttpChannel();
|
|
|
|
virtual ~nsHttpChannel();
|
|
|
|
|
2010-06-23 04:33:57 +04:00
|
|
|
virtual nsresult Init(nsIURI *aURI, PRUint8 aCaps, nsProxyInfo *aProxyInfo);
|
|
|
|
|
2010-04-07 12:43:09 +04:00
|
|
|
// Methods HttpBaseChannel didn't implement for us or that we override.
|
|
|
|
//
|
|
|
|
// nsIRequest
|
|
|
|
NS_IMETHOD Cancel(nsresult status);
|
|
|
|
NS_IMETHOD Suspend();
|
|
|
|
NS_IMETHOD Resume();
|
|
|
|
// nsIChannel
|
|
|
|
NS_IMETHOD GetSecurityInfo(nsISupports **aSecurityInfo);
|
|
|
|
NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *aContext);
|
|
|
|
// nsIHttpChannelInternal
|
|
|
|
NS_IMETHOD SetupFallbackChannel(const char *aFallbackKey);
|
2010-04-11 08:53:35 +04:00
|
|
|
// nsISupportsPriority
|
|
|
|
NS_IMETHOD SetPriority(PRInt32 value);
|
2010-08-11 07:07:09 +04:00
|
|
|
// nsIResumableChannel
|
|
|
|
NS_IMETHOD ResumeAt(PRUint64 startPos, const nsACString& entityID);
|
2010-04-07 12:43:09 +04:00
|
|
|
|
|
|
|
public: /* internal necko use only */
|
2011-05-14 07:48:38 +04:00
|
|
|
typedef void (nsHttpChannel:: *nsAsyncCallback)(void);
|
2010-10-02 08:17:23 +04:00
|
|
|
|
2010-05-31 02:30:28 +04:00
|
|
|
void InternalSetUploadStream(nsIInputStream *uploadStream)
|
|
|
|
{ mUploadStream = uploadStream; }
|
|
|
|
void SetUploadStreamHasHeaders(PRBool hasHeaders)
|
|
|
|
{ mUploadStreamHasHeaders = hasHeaders; }
|
2004-11-15 23:16:52 +03:00
|
|
|
|
2010-04-07 12:43:44 +04:00
|
|
|
nsresult SetReferrerInternal(nsIURI *referrer) {
|
|
|
|
nsCAutoString spec;
|
|
|
|
nsresult rv = referrer->GetAsciiSpec(spec);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
mReferrer = referrer;
|
|
|
|
mRequestHead.SetHeader(nsHttp::Referer, spec);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2010-07-28 22:33:06 +04:00
|
|
|
typedef nsresult (nsHttpChannel::*nsContinueRedirectionFunc)(nsresult result);
|
|
|
|
|
2011-05-14 07:48:38 +04:00
|
|
|
// AsyncCall may be used to call a member function asynchronously.
|
|
|
|
// retval isn't refcounted and is set only when event was successfully
|
|
|
|
// posted, the event is returned for the purpose of cancelling when needed
|
|
|
|
nsresult AsyncCall(nsAsyncCallback funcPtr,
|
|
|
|
nsRunnableMethod<nsHttpChannel> **retval = nsnull);
|
|
|
|
|
2006-06-23 04:49:40 +04:00
|
|
|
PRBool RequestIsConditional();
|
2001-05-12 01:04:09 +04:00
|
|
|
nsresult Connect(PRBool firstTime = PR_TRUE);
|
2011-05-14 07:48:38 +04:00
|
|
|
nsresult AsyncAbort(nsresult status);
|
|
|
|
// Send OnStartRequest/OnStopRequest to our listener, if any.
|
|
|
|
void HandleAsyncNotifyListener();
|
|
|
|
void DoNotifyListener();
|
2001-05-12 01:04:09 +04:00
|
|
|
nsresult SetupTransaction();
|
2002-11-07 01:29:17 +03:00
|
|
|
nsresult CallOnStartRequest();
|
2001-05-12 01:04:09 +04:00
|
|
|
nsresult ProcessResponse();
|
2010-07-28 22:33:06 +04:00
|
|
|
nsresult ContinueProcessResponse(nsresult);
|
2001-05-12 01:04:09 +04:00
|
|
|
nsresult ProcessNormal();
|
2010-07-28 22:33:06 +04:00
|
|
|
nsresult ContinueProcessNormal(nsresult);
|
2001-05-12 01:04:09 +04:00
|
|
|
nsresult ProcessNotModified();
|
2010-07-28 22:33:06 +04:00
|
|
|
nsresult AsyncProcessRedirection(PRUint32 httpStatus);
|
|
|
|
nsresult ContinueProcessRedirection(nsresult);
|
|
|
|
nsresult ContinueProcessRedirectionAfterFallback(nsresult);
|
2009-05-17 18:22:55 +04:00
|
|
|
PRBool ShouldSSLProxyResponseContinue(PRUint32 httpStatus);
|
2009-04-23 23:49:32 +04:00
|
|
|
nsresult ProcessFailedSSLConnect(PRUint32 httpStatus);
|
2010-07-28 22:33:06 +04:00
|
|
|
nsresult ProcessFallback(PRBool *waitingForRedirectCallback);
|
|
|
|
nsresult ContinueProcessFallback(nsresult);
|
2003-05-13 08:38:25 +04:00
|
|
|
PRBool ResponseWouldVary();
|
2003-04-16 03:07:12 +04:00
|
|
|
|
2010-07-28 22:33:06 +04:00
|
|
|
nsresult ContinueOnStartRequest1(nsresult);
|
|
|
|
nsresult ContinueOnStartRequest2(nsresult);
|
|
|
|
nsresult ContinueOnStartRequest3(nsresult);
|
|
|
|
|
2003-04-16 03:07:12 +04:00
|
|
|
// redirection specific methods
|
|
|
|
void HandleAsyncRedirect();
|
2010-07-28 22:33:06 +04:00
|
|
|
nsresult ContinueHandleAsyncRedirect(nsresult);
|
2003-04-16 03:07:12 +04:00
|
|
|
void HandleAsyncNotModified();
|
2008-09-30 22:34:23 +04:00
|
|
|
void HandleAsyncFallback();
|
2010-07-28 22:33:06 +04:00
|
|
|
nsresult ContinueHandleAsyncFallback(nsresult);
|
2003-03-25 04:19:21 +03:00
|
|
|
nsresult PromptTempRedirect();
|
2010-08-11 07:11:57 +04:00
|
|
|
virtual nsresult SetupReplacementChannel(nsIURI *, nsIChannel *, PRBool preserveMethod);
|
2001-05-12 01:04:09 +04:00
|
|
|
|
2005-06-25 03:58:25 +04:00
|
|
|
// proxy specific methods
|
|
|
|
nsresult ProxyFailover();
|
2010-07-28 22:33:06 +04:00
|
|
|
nsresult AsyncDoReplaceWithProxy(nsIProxyInfo *);
|
|
|
|
nsresult ContinueDoReplaceWithProxy(nsresult);
|
2007-08-23 22:56:12 +04:00
|
|
|
void HandleAsyncReplaceWithProxy();
|
2010-07-28 22:33:06 +04:00
|
|
|
nsresult ContinueHandleAsyncReplaceWithProxy(nsresult);
|
2005-06-25 03:58:25 +04:00
|
|
|
nsresult ResolveProxy();
|
|
|
|
|
2001-05-12 01:04:09 +04:00
|
|
|
// cache specific methods
|
2010-09-16 02:46:17 +04:00
|
|
|
nsresult OpenCacheEntry();
|
|
|
|
nsresult OnOfflineCacheEntryAvailable(nsICacheEntryDescriptor *aEntry,
|
|
|
|
nsCacheAccessMode aAccess,
|
|
|
|
nsresult aResult,
|
|
|
|
PRBool aSync);
|
|
|
|
nsresult OpenNormalCacheEntry(PRBool aSync);
|
|
|
|
nsresult OnNormalCacheEntryAvailable(nsICacheEntryDescriptor *aEntry,
|
|
|
|
nsCacheAccessMode aAccess,
|
|
|
|
nsresult aResult,
|
|
|
|
PRBool aSync);
|
2007-03-14 04:52:07 +03:00
|
|
|
nsresult OpenOfflineCacheEntryForWriting();
|
2008-10-10 20:14:51 +04:00
|
|
|
nsresult GenerateCacheKey(PRUint32 postID, nsACString &key);
|
2001-05-12 01:04:09 +04:00
|
|
|
nsresult UpdateExpirationTime();
|
2004-03-14 22:20:24 +03:00
|
|
|
nsresult CheckCache();
|
2007-03-14 04:52:07 +03:00
|
|
|
nsresult ShouldUpdateOfflineCacheEntry(PRBool *shouldCacheForOfflineUse);
|
2001-05-12 01:04:09 +04:00
|
|
|
nsresult ReadFromCache();
|
2008-09-10 05:39:38 +04:00
|
|
|
void CloseCacheEntry(PRBool doomOnFailure);
|
2007-03-14 04:52:07 +03:00
|
|
|
void CloseOfflineCacheEntry();
|
2001-06-26 11:08:52 +04:00
|
|
|
nsresult InitCacheEntry();
|
2007-03-14 04:52:07 +03:00
|
|
|
nsresult InitOfflineCacheEntry();
|
|
|
|
nsresult AddCacheEntryHeaders(nsICacheEntryDescriptor *entry);
|
|
|
|
nsresult StoreAuthorizationMetaData(nsICacheEntryDescriptor *entry);
|
2001-08-22 04:26:42 +04:00
|
|
|
nsresult FinalizeCacheEntry();
|
2002-03-27 02:33:19 +03:00
|
|
|
nsresult InstallCacheListener(PRUint32 offset = 0);
|
2007-03-14 04:52:07 +03:00
|
|
|
nsresult InstallOfflineCacheListener();
|
2008-10-10 20:14:51 +04:00
|
|
|
void MaybeInvalidateCacheEntryForSubsequentGet();
|
|
|
|
nsCacheStoragePolicy DetermineStoragePolicy();
|
2010-09-16 02:46:17 +04:00
|
|
|
nsresult DetermineCacheAccess(nsCacheAccessMode *_retval);
|
2009-02-12 07:16:00 +03:00
|
|
|
void AsyncOnExamineCachedResponse();
|
2002-03-27 02:33:19 +03:00
|
|
|
|
2008-08-01 04:55:14 +04:00
|
|
|
// Handle the bogus Content-Encoding Apache sometimes sends
|
|
|
|
void ClearBogusContentEncodingIfNeeded();
|
|
|
|
|
2002-03-27 02:33:19 +03:00
|
|
|
// byte range request specific methods
|
|
|
|
nsresult SetupByteRangeRequest(PRUint32 partialLen);
|
|
|
|
nsresult ProcessPartialContent();
|
|
|
|
nsresult OnDoneReadingPartialCacheEntry(PRBool *streamDone);
|
2001-05-12 01:04:09 +04:00
|
|
|
|
2003-03-26 08:05:49 +03:00
|
|
|
nsresult DoAuthRetry(nsAHttpConnection *);
|
2009-06-16 20:27:17 +04:00
|
|
|
PRBool MustValidateBasedOnQueryUrl();
|
2001-05-12 01:04:09 +04:00
|
|
|
|
2010-06-04 01:03:17 +04:00
|
|
|
void HandleAsyncRedirectChannelToHttps();
|
|
|
|
nsresult AsyncRedirectChannelToHttps();
|
|
|
|
nsresult ContinueAsyncRedirectChannelToHttps(nsresult rv);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A function that takes care of reading STS headers and enforcing STS
|
|
|
|
* load rules. After a secure channel is erected, STS requires the channel
|
|
|
|
* to be trusted or any STS header data on the channel is ignored.
|
|
|
|
* This is called from ProcessResponse.
|
|
|
|
*/
|
|
|
|
nsresult ProcessSTSHeader();
|
|
|
|
|
2010-11-26 20:13:37 +03:00
|
|
|
/**
|
|
|
|
* Computes and returns a 64 bit encoded string holding a hash of the
|
|
|
|
* input buffer. Input buffer must be a null-terminated string.
|
|
|
|
*/
|
|
|
|
nsresult Hash(const char *buf, nsACString &hash);
|
|
|
|
|
2001-05-12 01:04:09 +04:00
|
|
|
private:
|
2001-05-17 23:42:57 +04:00
|
|
|
nsCOMPtr<nsISupports> mSecurityInfo;
|
2005-06-25 03:58:25 +04:00
|
|
|
nsCOMPtr<nsICancelable> mProxyRequest;
|
2001-05-12 01:04:09 +04:00
|
|
|
|
2006-03-04 00:06:53 +03:00
|
|
|
nsRefPtr<nsInputStreamPump> mTransactionPump;
|
2010-04-07 12:43:09 +04:00
|
|
|
nsRefPtr<nsHttpTransaction> mTransaction;
|
2001-05-12 01:04:09 +04:00
|
|
|
|
2009-08-12 12:51:46 +04:00
|
|
|
PRUint64 mLogicalOffset;
|
2004-10-29 02:52:45 +04:00
|
|
|
|
2001-05-12 01:04:09 +04:00
|
|
|
// cache specific data
|
|
|
|
nsCOMPtr<nsICacheEntryDescriptor> mCacheEntry;
|
2006-03-04 00:06:53 +03:00
|
|
|
nsRefPtr<nsInputStreamPump> mCachePump;
|
2010-04-07 12:43:09 +04:00
|
|
|
nsAutoPtr<nsHttpResponseHead> mCachedResponseHead;
|
2001-05-12 01:04:09 +04:00
|
|
|
nsCacheAccessMode mCacheAccess;
|
|
|
|
PRUint32 mPostID;
|
|
|
|
PRUint32 mRequestTime;
|
|
|
|
|
2010-09-16 02:46:17 +04:00
|
|
|
typedef nsresult (nsHttpChannel:: *nsOnCacheEntryAvailableCallback)(
|
|
|
|
nsICacheEntryDescriptor *, nsCacheAccessMode, nsresult, PRBool);
|
|
|
|
nsOnCacheEntryAvailableCallback mOnCacheEntryAvailableCallback;
|
|
|
|
PRBool mAsyncCacheOpen;
|
|
|
|
|
2007-03-14 04:52:07 +03:00
|
|
|
nsCOMPtr<nsICacheEntryDescriptor> mOfflineCacheEntry;
|
|
|
|
nsCacheAccessMode mOfflineCacheAccess;
|
2007-07-25 10:31:27 +04:00
|
|
|
nsCString mOfflineCacheClientID;
|
2007-03-14 04:52:07 +03:00
|
|
|
|
2001-12-05 02:49:06 +03:00
|
|
|
// auth specific data
|
2010-06-17 22:33:42 +04:00
|
|
|
nsCOMPtr<nsIHttpChannelAuthProvider> mAuthProvider;
|
2009-07-20 22:29:41 +04:00
|
|
|
|
2011-05-14 07:48:38 +04:00
|
|
|
// Function pointer that can be set to indicate that we got suspended while
|
|
|
|
// waiting on an AsyncCall. When we get resumed we should AsyncCall this
|
|
|
|
// function.
|
|
|
|
nsAsyncCallback mPendingAsyncCallOnResume;
|
|
|
|
|
2007-08-23 22:56:12 +04:00
|
|
|
// Proxy info to replace with
|
|
|
|
nsCOMPtr<nsIProxyInfo> mTargetProxyInfo;
|
|
|
|
|
2011-05-14 07:48:38 +04:00
|
|
|
// Suspend counter. This is used if someone tries to suspend/resume us
|
|
|
|
// before we have either a cache pump or a transaction pump.
|
|
|
|
PRUint32 mSuspendCount;
|
|
|
|
|
2008-09-30 22:34:23 +04:00
|
|
|
// If the channel is associated with a cache, and the URI matched
|
|
|
|
// a fallback namespace, this will hold the key for the fallback
|
|
|
|
// cache entry.
|
|
|
|
nsCString mFallbackKey;
|
|
|
|
|
2010-06-04 01:03:17 +04:00
|
|
|
friend class AutoRedirectVetoNotifier;
|
2010-07-28 22:33:06 +04:00
|
|
|
nsCOMPtr<nsIURI> mRedirectURI;
|
|
|
|
nsCOMPtr<nsIChannel> mRedirectChannel;
|
|
|
|
PRUint32 mRedirectType;
|
|
|
|
|
2003-03-26 08:05:49 +03:00
|
|
|
// state flags
|
|
|
|
PRUint32 mCachedContentIsValid : 1;
|
|
|
|
PRUint32 mCachedContentIsPartial : 1;
|
|
|
|
PRUint32 mTransactionReplaced : 1;
|
|
|
|
PRUint32 mAuthRetryPending : 1;
|
2004-04-14 21:37:39 +04:00
|
|
|
PRUint32 mResuming : 1;
|
2006-03-31 01:06:54 +04:00
|
|
|
PRUint32 mInitedCacheEntry : 1;
|
2007-03-14 04:52:07 +03:00
|
|
|
PRUint32 mCacheForOfflineUse : 1;
|
2008-09-30 22:34:23 +04:00
|
|
|
// True if mCacheForOfflineUse was set because we were caching
|
|
|
|
// opportunistically.
|
|
|
|
PRUint32 mCachingOpportunistically : 1;
|
|
|
|
// True if we are loading a fallback cache entry from the
|
|
|
|
// application cache.
|
|
|
|
PRUint32 mFallbackChannel : 1;
|
2008-08-25 21:21:28 +04:00
|
|
|
PRUint32 mTracingEnabled : 1;
|
2009-10-21 21:34:47 +04:00
|
|
|
// True if consumer added its own If-None-Match or If-Modified-Since
|
2009-10-21 14:18:08 +04:00
|
|
|
// headers. In such a case we must not override them in the cache code
|
|
|
|
// and also we want to pass possible 304 code response through.
|
|
|
|
PRUint32 mCustomConditionalRequest : 1;
|
2010-07-28 22:33:06 +04:00
|
|
|
PRUint32 mFallingBack : 1;
|
|
|
|
PRUint32 mWaitingForRedirectCallback : 1;
|
2010-08-03 00:24:18 +04:00
|
|
|
// True if mRequestTime has been set. In such a case it is safe to update
|
|
|
|
// the cache entry's expiration time. Otherwise, it is not(see bug 567360).
|
2011-01-25 01:59:51 +03:00
|
|
|
PRUint32 mRequestTimeInitialized : 1;
|
2002-03-14 03:51:28 +03:00
|
|
|
|
2010-07-28 22:33:06 +04:00
|
|
|
nsTArray<nsContinueRedirectionFunc> mRedirectFuncStack;
|
|
|
|
|
2010-11-26 20:13:37 +03:00
|
|
|
nsCOMPtr<nsICryptoHash> mHasher;
|
|
|
|
|
2011-05-21 14:03:36 +04:00
|
|
|
PRTime mChannelCreationTime;
|
|
|
|
mozilla::TimeStamp mChannelCreationTimestamp;
|
|
|
|
mozilla::TimeStamp mAsyncOpenTime;
|
|
|
|
mozilla::TimeStamp mCacheReadStart;
|
|
|
|
mozilla::TimeStamp mCacheReadEnd;
|
|
|
|
// copied from the transaction before we null out mTransaction
|
|
|
|
// so that the timing can still be queried from OnStopRequest
|
|
|
|
TimingStruct mTransactionTimings;
|
|
|
|
|
2010-07-28 22:33:06 +04:00
|
|
|
nsresult WaitForRedirectCallback();
|
|
|
|
void PushRedirectAsyncFunc(nsContinueRedirectionFunc func);
|
|
|
|
void PopRedirectAsyncFunc(nsContinueRedirectionFunc func);
|
2001-05-12 01:04:09 +04:00
|
|
|
};
|
|
|
|
|
2001-08-08 14:03:53 +04:00
|
|
|
#endif // nsHttpChannel_h__
|