summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_network_layer.cc3
-rw-r--r--net/http/http_network_session.h7
-rw-r--r--net/http/http_network_transaction.cc133
-rw-r--r--net/http/http_network_transaction.h51
-rw-r--r--net/http/http_network_transaction_unittest.cc177
5 files changed, 196 insertions, 175 deletions
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index b46012f..6c905e7 100644
--- a/net/http/http_network_layer.cc
+++ b/net/http/http_network_layer.cc
@@ -66,8 +66,7 @@ void HttpNetworkLayer::Suspend(bool suspend) {
HttpNetworkSession* HttpNetworkLayer::GetSession() {
if (!session_) {
DCHECK(proxy_service_);
- session_ = new HttpNetworkSession(proxy_service_,
- ClientSocketFactory::GetDefaultFactory());
+ session_ = new HttpNetworkSession(proxy_service_);
}
return session_;
}
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h
index d96255a..7c4ac68 100644
--- a/net/http/http_network_session.h
+++ b/net/http/http_network_session.h
@@ -12,16 +12,13 @@
namespace net {
-class ClientSocketFactory;
class ProxyService;
// This class holds session objects used by HttpNetworkTransaction objects.
class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> {
public:
- HttpNetworkSession(ProxyService* proxy_service,
- ClientSocketFactory* client_socket_factory)
- : connection_pool_(new ClientSocketPool(
- max_sockets_per_group_, client_socket_factory)),
+ explicit HttpNetworkSession(ProxyService* proxy_service)
+ : connection_pool_(new ClientSocketPool(max_sockets_per_group_)),
proxy_service_(proxy_service) {
DCHECK(proxy_service);
}
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 159d07e..99a02ba 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -182,7 +182,7 @@ int HttpNetworkTransaction::RestartIgnoringLastError(
if (connection_.socket()->IsConnected()) {
next_state_ = STATE_WRITE_HEADERS;
} else {
- connection_.socket()->Disconnect();
+ connection_.set_socket(NULL);
connection_.Reset();
next_state_ = STATE_INIT_CONNECTION;
}
@@ -306,7 +306,7 @@ void HttpNetworkTransaction::DidDrainBodyForAuthRestart(bool keep_alive) {
reused_socket_ = true;
} else {
next_state_ = STATE_INIT_CONNECTION;
- connection_.socket()->Disconnect();
+ connection_.set_socket(NULL);
connection_.Reset();
}
@@ -356,8 +356,10 @@ LoadState HttpNetworkTransaction::GetLoadState() const {
switch (next_state_) {
case STATE_RESOLVE_PROXY_COMPLETE:
return LOAD_STATE_RESOLVING_PROXY_FOR_URL;
- case STATE_INIT_CONNECTION_COMPLETE:
- return connection_.GetLoadState();
+ case STATE_RESOLVE_HOST_COMPLETE:
+ return LOAD_STATE_RESOLVING_HOST;
+ case STATE_TCP_CONNECT_COMPLETE:
+ return LOAD_STATE_CONNECTING;
case STATE_WRITE_HEADERS_COMPLETE:
case STATE_WRITE_BODY_COMPLETE:
return LOAD_STATE_SENDING_REQUEST;
@@ -378,10 +380,10 @@ uint64 HttpNetworkTransaction::GetUploadProgress() const {
}
HttpNetworkTransaction::~HttpNetworkTransaction() {
- // If we still have an open socket, then make sure to disconnect it so we
- // don't try to reuse it later on.
+ // If we still have an open socket, then make sure to close it so we don't
+ // try to reuse it later on.
if (connection_.is_initialized())
- connection_.socket()->Disconnect();
+ connection_.set_socket(NULL);
if (pac_request_)
session_->proxy_service()->CancelPacRequest(pac_request_);
@@ -429,6 +431,24 @@ int HttpNetworkTransaction::DoLoop(int result) {
rv = DoInitConnectionComplete(rv);
TRACE_EVENT_END("http.init_conn", request_, request_->url.spec());
break;
+ case STATE_RESOLVE_HOST:
+ DCHECK_EQ(OK, rv);
+ TRACE_EVENT_BEGIN("http.resolve_host", request_, request_->url.spec());
+ rv = DoResolveHost();
+ break;
+ case STATE_RESOLVE_HOST_COMPLETE:
+ rv = DoResolveHostComplete(rv);
+ TRACE_EVENT_END("http.resolve_host", request_, request_->url.spec());
+ break;
+ case STATE_TCP_CONNECT:
+ DCHECK_EQ(OK, rv);
+ TRACE_EVENT_BEGIN("http.connect", request_, request_->url.spec());
+ rv = DoTCPConnect();
+ break;
+ case STATE_TCP_CONNECT_COMPLETE:
+ rv = DoTCPConnectComplete(rv);
+ TRACE_EVENT_END("http.connect", request_, request_->url.spec());
+ break;
case STATE_SSL_CONNECT:
DCHECK_EQ(OK, rv);
TRACE_EVENT_BEGIN("http.ssl_connect", request_, request_->url.spec());
@@ -538,41 +558,83 @@ int HttpNetworkTransaction::DoInitConnection() {
// Build the string used to uniquely identify connections of this type.
std::string connection_group;
- std::string host;
- int port;
- if (using_proxy_ || using_tunnel_) {
- ProxyServer proxy_server = proxy_info_.proxy_server();
- connection_group = "proxy/" + proxy_server.ToURI() + "/";
- host = proxy_server.HostNoBrackets();
- port = proxy_server.port();
- } else {
- host = request_->url.HostNoBrackets();
- port = request_->url.EffectiveIntPort();
- }
+ if (using_proxy_ || using_tunnel_)
+ connection_group = "proxy/" + proxy_info_.proxy_server().ToURI() + "/";
if (!using_proxy_)
connection_group.append(request_->url.GetOrigin().spec());
DCHECK(!connection_group.empty());
- int rv = connection_.Init(connection_group, host, port, request_->priority,
- &io_callback_);
- return rv;
+ return connection_.Init(connection_group, request_->priority, &io_callback_);
}
int HttpNetworkTransaction::DoInitConnectionComplete(int result) {
if (result < 0)
- return ReconsiderProxyAfterError(result);
+ return result;
DCHECK(connection_.is_initialized());
// Set the reused_socket_ flag to indicate that we are using a keep-alive
// connection. This flag is used to handle errors that occur while we are
// trying to reuse a keep-alive connection.
- reused_socket_ = connection_.is_reused();
+ reused_socket_ = (connection_.socket() != NULL);
if (reused_socket_) {
next_state_ = STATE_WRITE_HEADERS;
} else {
- // Now we have a TCP connected socket. Perform other connection setup as
- // needed.
+ next_state_ = STATE_RESOLVE_HOST;
+ }
+ return OK;
+}
+
+int HttpNetworkTransaction::DoResolveHost() {
+ next_state_ = STATE_RESOLVE_HOST_COMPLETE;
+
+ std::string host;
+ int port;
+
+ // Determine the host and port to connect to.
+ if (using_proxy_ || using_tunnel_) {
+ ProxyServer proxy_server = proxy_info_.proxy_server();
+ host = proxy_server.HostNoBrackets();
+ port = proxy_server.port();
+ } else {
+ // Direct connection
+ host = request_->url.HostNoBrackets();
+ port = request_->url.EffectiveIntPort();
+ }
+
+ host_resolution_start_time_ = base::Time::Now();
+
+ DidStartDnsResolution(host, this);
+ return resolver_.Resolve(host, port, &addresses_, &io_callback_);
+}
+
+int HttpNetworkTransaction::DoResolveHostComplete(int result) {
+ bool ok = (result == OK);
+ DidFinishDnsResolutionWithStatus(ok, request_->referrer, this);
+ if (ok) {
+ next_state_ = STATE_TCP_CONNECT;
+ } else {
+ result = ReconsiderProxyAfterError(result);
+ }
+ return result;
+}
+
+int HttpNetworkTransaction::DoTCPConnect() {
+ next_state_ = STATE_TCP_CONNECT_COMPLETE;
+
+ DCHECK(!connection_.socket());
+
+ connect_start_time_ = base::Time::Now();
+
+ ClientSocket* s = socket_factory_->CreateTCPClientSocket(addresses_);
+ connection_.set_socket(s);
+ return connection_.socket()->Connect(&io_callback_);
+}
+
+int HttpNetworkTransaction::DoTCPConnectComplete(int result) {
+ // If we are using a direct SSL connection, then go ahead and establish the
+ // SSL connection, now. Otherwise, we need to first issue a CONNECT request.
+ if (result == OK) {
LogTCPConnectedMetrics();
if (using_ssl_ && !using_tunnel_) {
next_state_ = STATE_SSL_CONNECT;
@@ -581,8 +643,10 @@ int HttpNetworkTransaction::DoInitConnectionComplete(int result) {
if (using_tunnel_)
establishing_tunnel_ = true;
}
+ } else {
+ result = ReconsiderProxyAfterError(result);
}
- return OK;
+ return result;
}
int HttpNetworkTransaction::DoSSLConnect() {
@@ -883,7 +947,7 @@ int HttpNetworkTransaction::DoReadBodyComplete(int result) {
if (done) {
LogTransactionMetrics();
if (!keep_alive)
- connection_.socket()->Disconnect();
+ connection_.set_socket(NULL);
connection_.Reset();
// The next Read call will return 0 (EOF).
}
@@ -955,6 +1019,15 @@ int HttpNetworkTransaction::DoDrainBodyForAuthRestartComplete(int result) {
}
void HttpNetworkTransaction::LogTCPConnectedMetrics() const {
+ DCHECK(connect_start_time_ != base::Time());
+ base::TimeDelta connect_duration =
+ base::Time::Now() - connect_start_time_;
+
+ UMA_HISTOGRAM_CLIPPED_TIMES(FieldTrial::MakeName(
+ "Net.TCP_Connection_Latency", "DnsImpact").data(), connect_duration,
+ base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10),
+ 100);
+
base::TimeDelta host_resolution_and_tcp_connection_latency =
base::Time::Now() - host_resolution_start_time_;
@@ -1227,7 +1300,7 @@ int HttpNetworkTransaction::HandleSSLHandshakeError(int error) {
// This could be a TLS-intolerant server or an SSL 3.0 server that
// chose a TLS-only cipher suite. Turn off TLS 1.0 and retry.
ssl_config_.tls1_enabled = false;
- connection_.socket()->Disconnect();
+ connection_.set_socket(NULL);
connection_.Reset();
next_state_ = STATE_INIT_CONNECTION;
error = OK;
@@ -1290,7 +1363,7 @@ bool HttpNetworkTransaction::ShouldResendRequest() const {
}
void HttpNetworkTransaction::ResetConnectionAndRequestForResend() {
- connection_.socket()->Disconnect();
+ connection_.set_socket(NULL);
connection_.Reset();
// There are two reasons we need to clear request_headers_. 1) It contains
// the real request headers, but we may need to resend the CONNECT request
@@ -1335,7 +1408,7 @@ int HttpNetworkTransaction::ReconsiderProxyAfterError(int error) {
int rv = session_->proxy_service()->ReconsiderProxyAfterError(
request_->url, &proxy_info_, &io_callback_, &pac_request_);
if (rv == OK || rv == ERR_IO_PENDING) {
- connection_.socket()->Disconnect();
+ connection_.set_socket(NULL);
connection_.Reset();
DCHECK(!request_headers_bytes_sent_);
next_state_ = STATE_RESOLVE_PROXY_COMPLETE;
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index e20239e..291091a 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -12,10 +12,7 @@
#include "base/time.h"
#include "net/base/address_list.h"
#include "net/base/client_socket_handle.h"
-#include "net/base/client_socket_pool.h"
#include "net/base/host_resolver.h"
-#include "net/base/load_flags.h"
-#include "net/base/load_states.h"
#include "net/base/ssl_config_service.h"
#include "net/http/http_auth.h"
#include "net/http/http_auth_handler.h"
@@ -90,26 +87,6 @@ class HttpNetworkTransaction : public HttpTransaction {
scoped_ptr_malloc<char> headers_;
};
- enum State {
- STATE_RESOLVE_PROXY,
- STATE_RESOLVE_PROXY_COMPLETE,
- STATE_INIT_CONNECTION,
- STATE_INIT_CONNECTION_COMPLETE,
- STATE_SSL_CONNECT,
- STATE_SSL_CONNECT_COMPLETE,
- STATE_WRITE_HEADERS,
- STATE_WRITE_HEADERS_COMPLETE,
- STATE_WRITE_BODY,
- STATE_WRITE_BODY_COMPLETE,
- STATE_READ_HEADERS,
- STATE_READ_HEADERS_COMPLETE,
- STATE_READ_BODY,
- STATE_READ_BODY_COMPLETE,
- STATE_DRAIN_BODY_FOR_AUTH_RESTART,
- STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE,
- STATE_NONE
- };
-
void DoCallback(int result);
void OnIOComplete(int result);
@@ -124,6 +101,10 @@ class HttpNetworkTransaction : public HttpTransaction {
int DoResolveProxyComplete(int result);
int DoInitConnection();
int DoInitConnectionComplete(int result);
+ int DoResolveHost();
+ int DoResolveHostComplete(int result);
+ int DoTCPConnect();
+ int DoTCPConnectComplete(int result);
int DoSSLConnect();
int DoSSLConnectComplete(int result);
int DoWriteHeaders();
@@ -381,7 +362,29 @@ class HttpNetworkTransaction : public HttpTransaction {
// The time the host resolution started (if it indeed got started).
base::Time host_resolution_start_time_;
- // The next state in the state machine.
+ enum State {
+ STATE_RESOLVE_PROXY,
+ STATE_RESOLVE_PROXY_COMPLETE,
+ STATE_INIT_CONNECTION,
+ STATE_INIT_CONNECTION_COMPLETE,
+ STATE_RESOLVE_HOST,
+ STATE_RESOLVE_HOST_COMPLETE,
+ STATE_TCP_CONNECT,
+ STATE_TCP_CONNECT_COMPLETE,
+ STATE_SSL_CONNECT,
+ STATE_SSL_CONNECT_COMPLETE,
+ STATE_WRITE_HEADERS,
+ STATE_WRITE_HEADERS_COMPLETE,
+ STATE_WRITE_BODY,
+ STATE_WRITE_BODY_COMPLETE,
+ STATE_READ_HEADERS,
+ STATE_READ_HEADERS_COMPLETE,
+ STATE_READ_BODY,
+ STATE_READ_BODY_COMPLETE,
+ STATE_DRAIN_BODY_FOR_AUTH_RESTART,
+ STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE,
+ STATE_NONE
+ };
State next_state_;
};
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index c18fa4d..007f0fb 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -351,9 +351,8 @@ ProxyService* CreateFixedProxyService(const std::string& proxy) {
}
-HttpNetworkSession* CreateSession(ProxyService* proxy_service,
- ClientSocketFactory* client_socket_factory) {
- return new HttpNetworkSession(proxy_service, client_socket_factory);
+HttpNetworkSession* CreateSession(ProxyService* proxy_service) {
+ return new HttpNetworkSession(proxy_service);
}
class HttpNetworkTransactionTest : public PlatformTest {
@@ -385,10 +384,8 @@ SimpleGetHelperResult SimpleGetHelper(MockRead data_reads[]) {
SimpleGetHelperResult out;
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -469,10 +466,8 @@ std::string MockGetHostName() {
TEST_F(HttpNetworkTransactionTest, Basic) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
}
TEST_F(HttpNetworkTransactionTest, SimpleGET) {
@@ -582,10 +577,8 @@ TEST_F(HttpNetworkTransactionTest, StopsReading204) {
// message body (since HEAD has none).
TEST_F(HttpNetworkTransactionTest, Head) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "HEAD";
@@ -647,7 +640,7 @@ TEST_F(HttpNetworkTransactionTest, Head) {
TEST_F(HttpNetworkTransactionTest, ReuseConnection) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
scoped_refptr<HttpNetworkSession> session =
- CreateSession(proxy_service.get(), &mock_socket_factory);
+ CreateSession(proxy_service.get());
MockRead data_reads[] = {
MockRead("HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n"),
@@ -697,10 +690,8 @@ TEST_F(HttpNetworkTransactionTest, ReuseConnection) {
TEST_F(HttpNetworkTransactionTest, Ignores100) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "POST";
@@ -745,10 +736,8 @@ TEST_F(HttpNetworkTransactionTest, Ignores100) {
// HTTP/1.1.
TEST_F(HttpNetworkTransactionTest, Ignores1xx) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -792,7 +781,7 @@ void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest(
const MockRead& read_failure) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
scoped_refptr<HttpNetworkSession> session =
- CreateSession(proxy_service.get(), &mock_socket_factory);
+ CreateSession(proxy_service.get());
HttpRequestInfo request;
request.method = "GET";
@@ -858,10 +847,8 @@ TEST_F(HttpNetworkTransactionTest, KeepAliveConnectionEOF) {
TEST_F(HttpNetworkTransactionTest, NonKeepAliveConnectionReset) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -915,10 +902,8 @@ TEST_F(HttpNetworkTransactionTest, NonKeepAliveConnectionEOF) {
// (basic auth is the easiest to mock, because it has no randomness).
TEST_F(HttpNetworkTransactionTest, BasicAuth) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -1008,10 +993,8 @@ TEST_F(HttpNetworkTransactionTest, BasicAuth) {
// connection.
TEST_F(HttpNetworkTransactionTest, BasicAuthKeepAlive) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -1088,10 +1071,8 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthKeepAlive) {
// connection and with no response body to drain.
TEST_F(HttpNetworkTransactionTest, BasicAuthKeepAliveNoBody) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -1171,10 +1152,8 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthKeepAliveNoBody) {
// connection and with a large response body to drain.
TEST_F(HttpNetworkTransactionTest, BasicAuthKeepAliveLargeBody) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -1261,7 +1240,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthProxyKeepAlive) {
CreateFixedProxyService("myproxy:70"));
scoped_refptr<HttpNetworkSession> session(
- CreateSession(proxy_service.get(), &mock_socket_factory));
+ CreateSession(proxy_service.get()));
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
session.get(), &mock_socket_factory));
@@ -1364,7 +1343,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) {
CreateFixedProxyService("myproxy:70"));
scoped_refptr<HttpNetworkSession> session(
- CreateSession(proxy_service.get(), &mock_socket_factory));
+ CreateSession(proxy_service.get()));
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
session.get(), &mock_socket_factory));
@@ -1422,7 +1401,7 @@ static void ConnectStatusHelperWithExpectedStatus(
CreateFixedProxyService("myproxy:70"));
scoped_refptr<HttpNetworkSession> session(
- CreateSession(proxy_service.get(), &mock_socket_factory));
+ CreateSession(proxy_service.get()));
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
session.get(), &mock_socket_factory));
@@ -1638,7 +1617,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthProxyThenServer) {
// Configure against proxy server "myproxy:70".
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
+ CreateSession(proxy_service.get()),
&mock_socket_factory));
HttpRequestInfo request;
@@ -1777,10 +1756,8 @@ TEST_F(HttpNetworkTransactionTest, NTLMAuth1) {
MockGetHostName);
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -1907,10 +1884,8 @@ TEST_F(HttpNetworkTransactionTest, NTLMAuth2) {
MockGetHostName);
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -2118,10 +2093,8 @@ TEST_F(HttpNetworkTransactionTest, NTLMAuth2) {
// fail with ERR_RESPONSE_HEADERS_TOO_BIG.
TEST_F(HttpNetworkTransactionTest, LargeHeadersNoBody) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -2164,7 +2137,7 @@ TEST_F(HttpNetworkTransactionTest, DontRecycleTCPSocketForSSLTunnel) {
CreateFixedProxyService("myproxy:70"));
scoped_refptr<HttpNetworkSession> session(
- CreateSession(proxy_service.get(), &mock_socket_factory));
+ CreateSession(proxy_service.get()));
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
session.get(), &mock_socket_factory));
@@ -2223,7 +2196,7 @@ TEST_F(HttpNetworkTransactionTest, DontRecycleTCPSocketForSSLTunnel) {
TEST_F(HttpNetworkTransactionTest, RecycleSocket) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
scoped_refptr<HttpNetworkSession> session(
- CreateSession(proxy_service.get(), &mock_socket_factory));
+ CreateSession(proxy_service.get()));
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
session.get(), &mock_socket_factory));
@@ -2283,7 +2256,7 @@ TEST_F(HttpNetworkTransactionTest, RecycleSocket) {
TEST_F(HttpNetworkTransactionTest, RecycleSocketAfterZeroContentLength) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
scoped_refptr<HttpNetworkSession> session(
- CreateSession(proxy_service.get(), &mock_socket_factory));
+ CreateSession(proxy_service.get()));
scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
session.get(), &mock_socket_factory));
@@ -2358,7 +2331,7 @@ TEST_F(HttpNetworkTransactionTest, ResendRequestOnWriteBodyError) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
scoped_refptr<HttpNetworkSession> session =
- CreateSession(proxy_service.get(), &mock_socket_factory);
+ CreateSession(proxy_service.get());
// The first socket is used for transaction 1 and the first attempt of
// transaction 2.
@@ -2435,10 +2408,8 @@ TEST_F(HttpNetworkTransactionTest, ResendRequestOnWriteBodyError) {
// it fails the identity from the URL is used to answer the challenge.
TEST_F(HttpNetworkTransactionTest, AuthIdentityInUrl) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -2516,7 +2487,7 @@ TEST_F(HttpNetworkTransactionTest, AuthIdentityInUrl) {
TEST_F(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
scoped_refptr<HttpNetworkSession> session =
- CreateSession(proxy_service.get(), &mock_socket_factory);
+ CreateSession(proxy_service.get());
// Transaction 1: authenticate (foo, bar) on MyRealm1
{
@@ -2937,10 +2908,8 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) {
TEST_F(HttpNetworkTransactionTest, ResetStateForRestart) {
// Create a transaction (the dependencies aren't important).
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpNetworkTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpNetworkTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
// Setup some state (which we expect ResetStateForRestart() will clear).
trans->header_buf_->Realloc(10);
@@ -2997,10 +2966,8 @@ TEST_F(HttpNetworkTransactionTest, ResetStateForRestart) {
// Test HTTPS connections to a site with a bad certificate
TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificate) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -3109,10 +3076,8 @@ TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) {
mock_sockets_index = 0;
mock_ssl_sockets_index = 0;
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
int rv = trans->Start(&request, &callback);
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -3135,10 +3100,8 @@ TEST_F(HttpNetworkTransactionTest, HTTPSBadCertificateViaProxy) {
TEST_F(HttpNetworkTransactionTest, BuildRequest_UserAgent) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -3177,10 +3140,8 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_UserAgent) {
TEST_F(HttpNetworkTransactionTest, BuildRequest_Referer) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -3220,10 +3181,8 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_Referer) {
TEST_F(HttpNetworkTransactionTest, BuildRequest_PostContentLengthZero) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "POST";
@@ -3261,10 +3220,8 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_PostContentLengthZero) {
TEST_F(HttpNetworkTransactionTest, BuildRequest_PutContentLengthZero) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "PUT";
@@ -3302,10 +3259,8 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_PutContentLengthZero) {
TEST_F(HttpNetworkTransactionTest, BuildRequest_HeadContentLengthZero) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "HEAD";
@@ -3343,10 +3298,8 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_HeadContentLengthZero) {
TEST_F(HttpNetworkTransactionTest, BuildRequest_CacheControlNoCache) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -3387,10 +3340,8 @@ TEST_F(HttpNetworkTransactionTest, BuildRequest_CacheControlNoCache) {
TEST_F(HttpNetworkTransactionTest,
BuildRequest_CacheControlValidateCache) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";
@@ -3429,10 +3380,8 @@ TEST_F(HttpNetworkTransactionTest,
TEST_F(HttpNetworkTransactionTest, BuildRequest_ExtraHeaders) {
scoped_ptr<ProxyService> proxy_service(CreateNullProxyService());
- scoped_ptr<HttpTransaction> trans(
- new HttpNetworkTransaction(
- CreateSession(proxy_service.get(), &mock_socket_factory),
- &mock_socket_factory));
+ scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(
+ CreateSession(proxy_service.get()), &mock_socket_factory));
HttpRequestInfo request;
request.method = "GET";