2012-04-25 12:54:42 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2012-04-25 12:54:42 +00:00
|
|
|
|
|
|
|
#ifndef mozilla_net_NullHttpTransaction_h
|
|
|
|
#define mozilla_net_NullHttpTransaction_h
|
|
|
|
|
|
|
|
#include "nsAHttpTransaction.h"
|
2012-06-06 03:18:25 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-04-25 12:54:42 +00:00
|
|
|
|
|
|
|
// This is the minimal nsAHttpTransaction implementation. A NullHttpTransaction
|
|
|
|
// can be used to drive connection level semantics (such as SSL handshakes
|
|
|
|
// tunnels) so that a nsHttpConnection becomes fully established in
|
2012-06-22 19:06:00 +00:00
|
|
|
// anticipation of a real transaction needing to use it soon.
|
2012-04-25 12:54:42 +00:00
|
|
|
|
|
|
|
namespace mozilla { namespace net {
|
|
|
|
|
2014-01-07 22:05:56 +00:00
|
|
|
class nsAHttpConnection;
|
|
|
|
class nsHttpConnectionInfo;
|
|
|
|
class nsHttpRequestHead;
|
|
|
|
|
2012-06-06 03:18:25 +00:00
|
|
|
class NullHttpTransaction MOZ_FINAL : public nsAHttpTransaction
|
2012-04-25 12:54:42 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-07-19 02:24:13 +00:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2012-04-25 12:54:42 +00:00
|
|
|
NS_DECL_NSAHTTPTRANSACTION
|
|
|
|
|
|
|
|
NullHttpTransaction(nsHttpConnectionInfo *ci,
|
|
|
|
nsIInterfaceRequestor *callbacks,
|
2012-11-30 01:34:35 +00:00
|
|
|
uint32_t caps);
|
2012-04-25 12:54:42 +00:00
|
|
|
~NullHttpTransaction();
|
|
|
|
|
|
|
|
nsHttpConnectionInfo *ConnectionInfo() { return mConnectionInfo; }
|
|
|
|
|
2014-02-07 22:30:36 +00:00
|
|
|
// Overload of nsAHttpTransaction methods
|
|
|
|
bool IsNullTransaction() MOZ_OVERRIDE MOZ_FINAL { return true; }
|
|
|
|
bool ResponseTimeoutEnabled() const MOZ_OVERRIDE MOZ_FINAL {return true; }
|
|
|
|
PRIntervalTime ResponseTimeout() MOZ_OVERRIDE MOZ_FINAL
|
|
|
|
{
|
|
|
|
return PR_SecondsToInterval(15);
|
|
|
|
}
|
2012-06-22 01:14:40 +00:00
|
|
|
|
2012-04-25 12:54:42 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
nsresult mStatus;
|
2012-11-30 01:34:35 +00:00
|
|
|
uint32_t mCaps;
|
2013-11-27 18:19:14 +00:00
|
|
|
// mCapsToClear holds flags that should be cleared in mCaps, e.g. unset
|
|
|
|
// NS_HTTP_REFRESH_DNS when DNS refresh request has completed to avoid
|
|
|
|
// redundant requests on the network. To deal with raciness, only unsetting
|
|
|
|
// bitfields should be allowed: 'lost races' will thus err on the
|
|
|
|
// conservative side, e.g. by going ahead with a 2nd DNS refresh.
|
|
|
|
uint32_t mCapsToClear;
|
2012-04-25 12:54:42 +00:00
|
|
|
nsRefPtr<nsAHttpConnection> mConnection;
|
|
|
|
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
|
|
|
nsRefPtr<nsHttpConnectionInfo> mConnectionInfo;
|
|
|
|
nsHttpRequestHead *mRequestHead;
|
2012-05-22 20:12:40 +00:00
|
|
|
bool mIsDone;
|
2012-04-25 12:54:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}} // namespace mozilla::net
|
|
|
|
|
|
|
|
#endif // mozilla_net_NullHttpTransaction_h
|