netwerk/protocol/http/NullHttpTransaction.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef mozilla_net_NullHttpTransaction_h
michael@0 8 #define mozilla_net_NullHttpTransaction_h
michael@0 9
michael@0 10 #include "nsAHttpTransaction.h"
michael@0 11 #include "mozilla/Attributes.h"
michael@0 12
michael@0 13 // This is the minimal nsAHttpTransaction implementation. A NullHttpTransaction
michael@0 14 // can be used to drive connection level semantics (such as SSL handshakes
michael@0 15 // tunnels) so that a nsHttpConnection becomes fully established in
michael@0 16 // anticipation of a real transaction needing to use it soon.
michael@0 17
michael@0 18 namespace mozilla { namespace net {
michael@0 19
michael@0 20 class nsAHttpConnection;
michael@0 21 class nsHttpConnectionInfo;
michael@0 22 class nsHttpRequestHead;
michael@0 23
michael@0 24 class NullHttpTransaction MOZ_FINAL : public nsAHttpTransaction
michael@0 25 {
michael@0 26 public:
michael@0 27 NS_DECL_THREADSAFE_ISUPPORTS
michael@0 28 NS_DECL_NSAHTTPTRANSACTION
michael@0 29
michael@0 30 NullHttpTransaction(nsHttpConnectionInfo *ci,
michael@0 31 nsIInterfaceRequestor *callbacks,
michael@0 32 uint32_t caps);
michael@0 33 ~NullHttpTransaction();
michael@0 34
michael@0 35 nsHttpConnectionInfo *ConnectionInfo() { return mConnectionInfo; }
michael@0 36
michael@0 37 // Overload of nsAHttpTransaction methods
michael@0 38 bool IsNullTransaction() MOZ_OVERRIDE MOZ_FINAL { return true; }
michael@0 39 bool ResponseTimeoutEnabled() const MOZ_OVERRIDE MOZ_FINAL {return true; }
michael@0 40 PRIntervalTime ResponseTimeout() MOZ_OVERRIDE MOZ_FINAL
michael@0 41 {
michael@0 42 return PR_SecondsToInterval(15);
michael@0 43 }
michael@0 44
michael@0 45 private:
michael@0 46
michael@0 47 nsresult mStatus;
michael@0 48 uint32_t mCaps;
michael@0 49 // mCapsToClear holds flags that should be cleared in mCaps, e.g. unset
michael@0 50 // NS_HTTP_REFRESH_DNS when DNS refresh request has completed to avoid
michael@0 51 // redundant requests on the network. To deal with raciness, only unsetting
michael@0 52 // bitfields should be allowed: 'lost races' will thus err on the
michael@0 53 // conservative side, e.g. by going ahead with a 2nd DNS refresh.
michael@0 54 uint32_t mCapsToClear;
michael@0 55 nsRefPtr<nsAHttpConnection> mConnection;
michael@0 56 nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
michael@0 57 nsRefPtr<nsHttpConnectionInfo> mConnectionInfo;
michael@0 58 nsHttpRequestHead *mRequestHead;
michael@0 59 bool mIsDone;
michael@0 60 };
michael@0 61
michael@0 62 }} // namespace mozilla::net
michael@0 63
michael@0 64 #endif // mozilla_net_NullHttpTransaction_h

mercurial