1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/protocol/http/NullHttpTransaction.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 + 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_net_NullHttpTransaction_h 1.11 +#define mozilla_net_NullHttpTransaction_h 1.12 + 1.13 +#include "nsAHttpTransaction.h" 1.14 +#include "mozilla/Attributes.h" 1.15 + 1.16 +// This is the minimal nsAHttpTransaction implementation. A NullHttpTransaction 1.17 +// can be used to drive connection level semantics (such as SSL handshakes 1.18 +// tunnels) so that a nsHttpConnection becomes fully established in 1.19 +// anticipation of a real transaction needing to use it soon. 1.20 + 1.21 +namespace mozilla { namespace net { 1.22 + 1.23 +class nsAHttpConnection; 1.24 +class nsHttpConnectionInfo; 1.25 +class nsHttpRequestHead; 1.26 + 1.27 +class NullHttpTransaction MOZ_FINAL : public nsAHttpTransaction 1.28 +{ 1.29 +public: 1.30 + NS_DECL_THREADSAFE_ISUPPORTS 1.31 + NS_DECL_NSAHTTPTRANSACTION 1.32 + 1.33 + NullHttpTransaction(nsHttpConnectionInfo *ci, 1.34 + nsIInterfaceRequestor *callbacks, 1.35 + uint32_t caps); 1.36 + ~NullHttpTransaction(); 1.37 + 1.38 + nsHttpConnectionInfo *ConnectionInfo() { return mConnectionInfo; } 1.39 + 1.40 + // Overload of nsAHttpTransaction methods 1.41 + bool IsNullTransaction() MOZ_OVERRIDE MOZ_FINAL { return true; } 1.42 + bool ResponseTimeoutEnabled() const MOZ_OVERRIDE MOZ_FINAL {return true; } 1.43 + PRIntervalTime ResponseTimeout() MOZ_OVERRIDE MOZ_FINAL 1.44 + { 1.45 + return PR_SecondsToInterval(15); 1.46 + } 1.47 + 1.48 +private: 1.49 + 1.50 + nsresult mStatus; 1.51 + uint32_t mCaps; 1.52 + // mCapsToClear holds flags that should be cleared in mCaps, e.g. unset 1.53 + // NS_HTTP_REFRESH_DNS when DNS refresh request has completed to avoid 1.54 + // redundant requests on the network. To deal with raciness, only unsetting 1.55 + // bitfields should be allowed: 'lost races' will thus err on the 1.56 + // conservative side, e.g. by going ahead with a 2nd DNS refresh. 1.57 + uint32_t mCapsToClear; 1.58 + nsRefPtr<nsAHttpConnection> mConnection; 1.59 + nsCOMPtr<nsIInterfaceRequestor> mCallbacks; 1.60 + nsRefPtr<nsHttpConnectionInfo> mConnectionInfo; 1.61 + nsHttpRequestHead *mRequestHead; 1.62 + bool mIsDone; 1.63 +}; 1.64 + 1.65 +}} // namespace mozilla::net 1.66 + 1.67 +#endif // mozilla_net_NullHttpTransaction_h