summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-16 21:02:29 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-16 21:02:29 +0000
commitaf3490e9e22d301ff9dc521f4cee04ef1a20abd5 (patch)
treeec65534096822d4924eeb2fd61070be56c2d6847 /net
parent1f418eedde2047d92089e72265ec3e1706d97c10 (diff)
downloadchromium_src-af3490e9e22d301ff9dc521f4cee04ef1a20abd5.zip
chromium_src-af3490e9e22d301ff9dc521f4cee04ef1a20abd5.tar.gz
chromium_src-af3490e9e22d301ff9dc521f4cee04ef1a20abd5.tar.bz2
Revert 61897 - Do not use Alternate-Protocol for establishing new SpdySessions.
Only use Alternate-Protocol for latching onto existing SpdySessions. This is a temporary change until SSL improvements are made, so we can begin sending http over spdy when available. Note that we have to do proxy resolution one time to figure out how to check for the appropriate existing SpdySession. If no SpdySession exists, we fallback again and have to redo proxy resolution (since the alternate protocol of npn-spdy requires rewriting the URI from http:// to https://). So we may end up doing two proxy resolutions in the fallback case. I had to disable all the tests that test establishing a new SpdySession for http:// URIs, since we don't do that for now. BUG=none TEST=none Review URL: http://codereview.chromium.org/3573013 TBR=willchan@chromium.org Review URL: http://codereview.chromium.org/3751009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/run_all_unittests.cc3
-rw-r--r--net/http/http_network_transaction_unittest.cc54
-rw-r--r--net/http/http_stream_factory.cc3
-rw-r--r--net/http/http_stream_factory.h10
-rw-r--r--net/http/http_stream_request.cc13
5 files changed, 5 insertions, 78 deletions
diff --git a/net/base/run_all_unittests.cc b/net/base/run_all_unittests.cc
index 685d8df..d0822a0 100644
--- a/net/base/run_all_unittests.cc
+++ b/net/base/run_all_unittests.cc
@@ -6,7 +6,6 @@
#include "base/metrics/histogram.h"
#include "base/nss_util.h"
#include "net/base/net_test_suite.h"
-#include "net/http/http_stream_factory.h"
#if defined(OS_WIN)
#include "net/socket/ssl_client_socket_nss_factory.h"
#endif
@@ -25,7 +24,5 @@ int main(int argc, char** argv) {
base::EnsureNSPRInit();
#endif
- net::HttpStreamFactory::set_create_new_spdy_session_for_http(true);
-
return test_suite.Run();
}
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index a935df9..a128b3d 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -5037,6 +5037,7 @@ TEST_F(HttpNetworkTransactionTest, GroupNameForHTTPProxyConnections) {
"ssl/www.google.com:443",
true,
},
+
{
"http_proxy",
"http://host.with.alternate/direct",
@@ -5102,6 +5103,7 @@ TEST_F(HttpNetworkTransactionTest, GroupNameForSOCKSConnections) {
"socks5/ssl/www.google.com:443",
true,
},
+
{
"socks4://socks_proxy:1080",
"http://host.with.alternate/direct",
@@ -7612,56 +7614,4 @@ TEST_F(HttpNetworkTransactionTest, PreconnectWithExistingSpdySession) {
EXPECT_EQ(OK, callback.WaitForResult());
}
-
-TEST_F(HttpNetworkTransactionTest, DoNotCreateSpdySessionForHttp) {
- HttpStreamFactory::set_create_new_spdy_session_for_http(false);
- HttpStreamFactory::set_use_alternate_protocols(true);
- HttpStreamFactory::set_next_protos(kExpectedNPNString);
-
- SessionDependencies session_deps;
- HttpRequestInfo request;
- request.method = "GET";
- request.url = GURL("http://www.google.com/");
- request.load_flags = 0;
-
- MockRead data_reads[] = {
- MockRead("HTTP/1.1 200 OK\r\n\r\n"),
- MockRead("hello world"),
- MockRead(true, OK),
- };
- StaticSocketDataProvider data(
- data_reads, arraysize(data_reads), NULL, 0);
- session_deps.socket_factory.AddSocketDataProvider(&data);
-
- TestCompletionCallback callback;
-
- scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps));
-
- HostPortPair http_host_port_pair("www.google.com", 80);
- HttpAlternateProtocols* alternate_protocols =
- session->mutable_alternate_protocols();
- alternate_protocols->SetAlternateProtocolFor(
- http_host_port_pair, 443 /* port is ignored */,
- HttpAlternateProtocols::NPN_SPDY_2);
-
- scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session));
-
- int rv = trans->Start(&request, &callback, BoundNetLog());
- EXPECT_EQ(ERR_IO_PENDING, rv);
- EXPECT_EQ(OK, callback.WaitForResult());
-
- const HttpResponseInfo* response = trans->GetResponseInfo();
- ASSERT_TRUE(response != NULL);
- ASSERT_TRUE(response->headers != NULL);
- EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
-
- std::string response_data;
- ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data));
- EXPECT_EQ("hello world", response_data);
-
- HttpStreamFactory::set_next_protos("");
- HttpStreamFactory::set_use_alternate_protocols(false);
- HttpStreamFactory::set_create_new_spdy_session_for_http(true);
-}
-
} // namespace net
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc
index 35b471a..e30c0c5 100644
--- a/net/http/http_stream_factory.cc
+++ b/net/http/http_stream_factory.cc
@@ -29,8 +29,6 @@ bool HttpStreamFactory::force_spdy_over_ssl_ = true;
bool HttpStreamFactory::force_spdy_always_ = false;
// static
bool HttpStreamFactory::ignore_certificate_errors_ = false;
-// static
-bool HttpStreamFactory::g_create_new_spdy_session_for_http_ = false;
// static
void HttpStreamFactory::SetHostMappingRules(const std::string& rules) {
@@ -167,3 +165,4 @@ void HttpStreamFactory::OnPreconnectsComplete(
}
} // namespace net
+
diff --git a/net/http/http_stream_factory.h b/net/http/http_stream_factory.h
index e3b9f64..dceb00b 100644
--- a/net/http/http_stream_factory.h
+++ b/net/http/http_stream_factory.h
@@ -105,14 +105,6 @@ class HttpStreamFactory : public StreamFactory,
return ignore_certificate_errors_;
}
- static void set_create_new_spdy_session_for_http(bool value) {
- g_create_new_spdy_session_for_http_ = value;
- }
-
- static bool create_new_spdy_session_for_http() {
- return g_create_new_spdy_session_for_http_;
- }
-
static void SetHostMappingRules(const std::string& rules);
private:
@@ -127,7 +119,6 @@ class HttpStreamFactory : public StreamFactory,
static bool force_spdy_over_ssl_;
static bool force_spdy_always_;
static bool ignore_certificate_errors_;
- static bool g_create_new_spdy_session_for_http_;
DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory);
};
@@ -135,3 +126,4 @@ class HttpStreamFactory : public StreamFactory,
} // namespace net
#endif // NET_HTTP_HTTP_STREAM_FACTORY_H_
+
diff --git a/net/http/http_stream_request.cc b/net/http/http_stream_request.cc
index abf1e4c..2409d86 100644
--- a/net/http/http_stream_request.cc
+++ b/net/http/http_stream_request.cc
@@ -412,18 +412,7 @@ int HttpStreamRequest::DoResolveProxyComplete(int result) {
return ERR_NO_SUPPORTED_PROXIES;
}
- HostPortProxyPair pair(endpoint_, proxy_info()->proxy_server());
- if (!HttpStreamFactory::create_new_spdy_session_for_http() &&
- alternate_protocol_mode_ == kUsingAlternateProtocol &&
- !session_->spdy_session_pool()->HasSession(pair)) {
- // If we don't already have a SpdySession, then don't pay the SSL handshake
- // cost of setup. Just use HTTP.
- next_state_ = STATE_RESOLVE_PROXY;
- alternate_protocol_mode_ = kDoNotUseAlternateProtocol;
- } else {
- next_state_ = STATE_INIT_CONNECTION;
- }
-
+ next_state_ = STATE_INIT_CONNECTION;
return OK;
}