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