#ifndef NET_HTTP_HTTP_BASIC_STATE_H_
#define NET_HTTP_HTTP_BASIC_STATE_H_
#include <memory>
#include <set>
#include <string>
#include "base/memory/scoped_refptr.h"
#include "net/base/net_export.h"
#include "net/base/request_priority.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
namespace net {
class StreamSocketHandle;
class GrowableIOBuffer;
class IPEndPoint;
class HttpStreamParser;
struct HttpRequestInfo;
struct LoadTimingInfo;
class NetLogWithSource;
class SSLInfo;
class NET_EXPORT_PRIVATE HttpBasicState {
public:
HttpBasicState(std::unique_ptr<StreamSocketHandle> connection,
bool is_for_get_to_http_proxy);
HttpBasicState(const HttpBasicState&) = delete;
HttpBasicState& operator=(const HttpBasicState&) = delete;
~HttpBasicState();
void Initialize(const HttpRequestInfo* request_info,
RequestPriority priority,
const NetLogWithSource& net_log);
void Close(bool not_reusable);
HttpStreamParser* parser() const { return parser_.get(); }
bool is_for_get_to_http_proxy() const { return is_for_get_to_http_proxy_; }
StreamSocketHandle* connection() const { return connection_.get(); }
std::unique_ptr<StreamSocketHandle> ReleaseConnection();
scoped_refptr<GrowableIOBuffer> read_buf() const;
std::string GenerateRequestLine() const;
MutableNetworkTrafficAnnotationTag traffic_annotation() {
return traffic_annotation_;
}
bool IsConnectionReused() const;
void SetConnectionReused();
bool CanReuseConnection() const;
bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const;
void GetSSLInfo(SSLInfo* ssl_info);
int GetRemoteEndpoint(IPEndPoint* endpoint);
const std::set<std::string>& GetDnsAliases() const;
private:
scoped_refptr<GrowableIOBuffer> read_buf_;
std::unique_ptr<StreamSocketHandle> connection_;
std::unique_ptr<HttpStreamParser> parser_;
const bool is_for_get_to_http_proxy_;
MutableNetworkTrafficAnnotationTag traffic_annotation_;
};
}
#endif