michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: 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 mozilla_net_NullHttpTransaction_h michael@0: #define mozilla_net_NullHttpTransaction_h michael@0: michael@0: #include "nsAHttpTransaction.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: // This is the minimal nsAHttpTransaction implementation. A NullHttpTransaction michael@0: // can be used to drive connection level semantics (such as SSL handshakes michael@0: // tunnels) so that a nsHttpConnection becomes fully established in michael@0: // anticipation of a real transaction needing to use it soon. michael@0: michael@0: namespace mozilla { namespace net { michael@0: michael@0: class nsAHttpConnection; michael@0: class nsHttpConnectionInfo; michael@0: class nsHttpRequestHead; michael@0: michael@0: class NullHttpTransaction MOZ_FINAL : public nsAHttpTransaction michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSAHTTPTRANSACTION michael@0: michael@0: NullHttpTransaction(nsHttpConnectionInfo *ci, michael@0: nsIInterfaceRequestor *callbacks, michael@0: uint32_t caps); michael@0: ~NullHttpTransaction(); michael@0: michael@0: nsHttpConnectionInfo *ConnectionInfo() { return mConnectionInfo; } michael@0: michael@0: // Overload of nsAHttpTransaction methods michael@0: bool IsNullTransaction() MOZ_OVERRIDE MOZ_FINAL { return true; } michael@0: bool ResponseTimeoutEnabled() const MOZ_OVERRIDE MOZ_FINAL {return true; } michael@0: PRIntervalTime ResponseTimeout() MOZ_OVERRIDE MOZ_FINAL michael@0: { michael@0: return PR_SecondsToInterval(15); michael@0: } michael@0: michael@0: private: michael@0: michael@0: nsresult mStatus; michael@0: uint32_t mCaps; michael@0: // mCapsToClear holds flags that should be cleared in mCaps, e.g. unset michael@0: // NS_HTTP_REFRESH_DNS when DNS refresh request has completed to avoid michael@0: // redundant requests on the network. To deal with raciness, only unsetting michael@0: // bitfields should be allowed: 'lost races' will thus err on the michael@0: // conservative side, e.g. by going ahead with a 2nd DNS refresh. michael@0: uint32_t mCapsToClear; michael@0: nsRefPtr mConnection; michael@0: nsCOMPtr mCallbacks; michael@0: nsRefPtr mConnectionInfo; michael@0: nsHttpRequestHead *mRequestHead; michael@0: bool mIsDone; michael@0: }; michael@0: michael@0: }} // namespace mozilla::net michael@0: michael@0: #endif // mozilla_net_NullHttpTransaction_h