summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-23 15:12:58 +0000
committerricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-23 15:12:58 +0000
commitdc2e3e3468360b21772ad9a89957c909f1e8feb1 (patch)
tree2346a9aca35d4793590625049e1de5e48a2ac1dd /net/http
parent5485d8c22b1dac6b42ee89d5d5a0c5fa994f4b65 (diff)
downloadchromium_src-dc2e3e3468360b21772ad9a89957c909f1e8feb1.zip
chromium_src-dc2e3e3468360b21772ad9a89957c909f1e8feb1.tar.gz
chromium_src-dc2e3e3468360b21772ad9a89957c909f1e8feb1.tar.bz2
Temporarily disable WebSocket over SPDY.
WebSocket over SPDY is not yet implemented in the new WebSocket implementation. Temporarily disable attempts to re-use existing SPDY connections for WebSocket connections or create new ones. BUG=323846 TEST=net_unittests, wss://www.google.com/ Review URL: https://codereview.chromium.org/91263002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_stream_factory_impl.cc13
-rw-r--r--net/http/http_stream_factory_impl_job.cc16
-rw-r--r--net/http/http_stream_factory_impl_request.cc10
-rw-r--r--net/http/http_stream_factory_impl_unittest.cc62
4 files changed, 75 insertions, 26 deletions
diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc
index 056a0f6..81dcec0 100644
--- a/net/http/http_stream_factory_impl.cc
+++ b/net/http/http_stream_factory_impl.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "base/logging.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "net/base/net_log.h"
@@ -290,15 +291,9 @@ void HttpStreamFactoryImpl::OnNewSpdySessionReady(
using_spdy,
net_log);
if (for_websockets_) {
- WebSocketHandshakeStreamBase::CreateHelper* create_helper =
- request->websocket_handshake_stream_create_helper();
- DCHECK(create_helper);
- bool use_relative_url = direct || request->url().SchemeIs("wss");
- request->OnWebSocketHandshakeStreamReady(
- NULL,
- used_ssl_config,
- used_proxy_info,
- create_helper->CreateSpdyStream(spdy_session, use_relative_url));
+ // TODO(ricea): Restore this code path when WebSocket over SPDY
+ // implementation is ready.
+ NOTREACHED();
} else {
bool use_relative_url = direct || request->url().SchemeIs("https");
request->OnStreamReady(
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc
index d60c522..a68b21f 100644
--- a/net/http/http_stream_factory_impl_job.cc
+++ b/net/http/http_stream_factory_impl_job.cc
@@ -291,8 +291,9 @@ bool HttpStreamFactoryImpl::Job::CanUseExistingSpdySession() const {
// The only time we can use an existing session is if the request URL is
// https (the normal case) or if we're connection to a SPDY proxy, or
// if we're running with force_spdy_always_. crbug.com/133176
+ // TODO(ricea): Add "wss" back to this list when SPDY WebSocket support is
+ // working.
return request_info_.url.SchemeIs("https") ||
- request_info_.url.SchemeIs("wss") ||
proxy_info_.proxy_server().is_https() ||
force_spdy_always_;
}
@@ -855,10 +856,13 @@ int HttpStreamFactoryImpl::Job::DoInitConnection() {
GetSpdySessionKey()) :
OnHostResolutionCallback();
if (stream_factory_->for_websockets_) {
+ // TODO(ricea): Re-enable NPN when WebSockets over SPDY is supported.
+ SSLConfig websocket_server_ssl_config = server_ssl_config_;
+ websocket_server_ssl_config.next_protos.clear();
return InitSocketHandleForWebSocketRequest(
origin_url_, request_info_.extra_headers, request_info_.load_flags,
priority_, session_, proxy_info_, ShouldForceSpdySSL(),
- want_spdy_over_npn, server_ssl_config_, proxy_ssl_config_,
+ want_spdy_over_npn, websocket_server_ssl_config, proxy_ssl_config_,
request_info_.privacy_mode, net_log_,
connection_.get(), resolution_callback, io_callback_);
}
@@ -1140,12 +1144,8 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() {
// will know when SpdySessions become available.
if (stream_factory_->for_websockets_) {
- DCHECK(request_);
- DCHECK(request_->websocket_handshake_stream_create_helper());
- bool use_relative_url = direct || request_info_.url.SchemeIs("wss");
- websocket_stream_.reset(
- request_->websocket_handshake_stream_create_helper()->CreateSpdyStream(
- spdy_session, use_relative_url));
+ // TODO(ricea): Restore this code when WebSockets over SPDY is implemented.
+ NOTREACHED();
} else {
bool use_relative_url = direct || request_info_.url.SchemeIs("https");
stream_.reset(new SpdyHttpStream(spdy_session, use_relative_url));
diff --git a/net/http/http_stream_factory_impl_request.cc b/net/http/http_stream_factory_impl_request.cc
index d731d41..ff66f14 100644
--- a/net/http/http_stream_factory_impl_request.cc
+++ b/net/http/http_stream_factory_impl_request.cc
@@ -318,13 +318,9 @@ void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady(
// Cache this so we can still use it if the request is deleted.
HttpStreamFactoryImpl* factory = factory_;
if (factory->for_websockets_) {
- DCHECK(websocket_handshake_stream_create_helper_);
- bool use_relative_url = direct || url().SchemeIs("wss");
- delegate_->OnWebSocketHandshakeStreamReady(
- job->server_ssl_config(),
- job->proxy_info(),
- websocket_handshake_stream_create_helper_->CreateSpdyStream(
- spdy_session, use_relative_url));
+ // TODO(ricea): Re-instate this code when WebSockets over SPDY is
+ // implemented.
+ NOTREACHED();
} else {
bool use_relative_url = direct || url().SchemeIs("https");
delegate_->OnStreamReady(
diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc
index 0a1d3bf..f2185a9 100644
--- a/net/http/http_stream_factory_impl_unittest.cc
+++ b/net/http/http_stream_factory_impl_unittest.cc
@@ -1131,7 +1131,64 @@ TEST_P(HttpStreamFactoryTest, RequestSpdyHttpStream) {
EXPECT_TRUE(waiter.used_proxy_info().is_direct());
}
-TEST_P(HttpStreamFactoryTest, RequestWebSocketSpdyHandshakeStream) {
+// TODO(ricea): This test can be removed once the new WebSocket stack supports
+// SPDY. Currently, even if we connect to a SPDY-supporting server, we need to
+// use plain SSL.
+TEST_P(HttpStreamFactoryTest, RequestWebSocketSpdyHandshakeStreamButGetSSL) {
+ SpdySessionDependencies session_deps(GetParam(),
+ ProxyService::CreateDirect());
+
+ MockRead mock_read(SYNCHRONOUS, ERR_IO_PENDING);
+ StaticSocketDataProvider socket_data(&mock_read, 1, NULL, 0);
+ socket_data.set_connect_data(MockConnect(ASYNC, OK));
+ session_deps.socket_factory->AddSocketDataProvider(&socket_data);
+
+ SSLSocketDataProvider ssl_socket_data(ASYNC, OK);
+ session_deps.socket_factory->AddSSLSocketDataProvider(&ssl_socket_data);
+
+ HostPortPair host_port_pair("www.google.com", 80);
+ scoped_refptr<HttpNetworkSession>
+ session(SpdySessionDependencies::SpdyCreateSession(&session_deps));
+
+ // Now request a stream.
+ HttpRequestInfo request_info;
+ request_info.method = "GET";
+ request_info.url = GURL("wss://www.google.com");
+ request_info.load_flags = 0;
+
+ SSLConfig ssl_config;
+ StreamRequestWaiter waiter1;
+ WebSocketStreamCreateHelper create_helper;
+ scoped_ptr<HttpStreamRequest> request1(
+ session->http_stream_factory_for_websocket()
+ ->RequestWebSocketHandshakeStream(request_info,
+ DEFAULT_PRIORITY,
+ ssl_config,
+ ssl_config,
+ &waiter1,
+ &create_helper,
+ BoundNetLog()));
+ waiter1.WaitForStream();
+ EXPECT_TRUE(waiter1.stream_done());
+ ASSERT_TRUE(NULL != waiter1.websocket_stream());
+ EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic,
+ waiter1.websocket_stream()->type());
+ EXPECT_TRUE(NULL == waiter1.stream());
+
+ EXPECT_EQ(0, GetSocketPoolGroupCount(
+ session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
+ EXPECT_EQ(0, GetSocketPoolGroupCount(
+ session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
+ EXPECT_EQ(1, GetSocketPoolGroupCount(
+ session->GetTransportSocketPool(
+ HttpNetworkSession::WEBSOCKET_SOCKET_POOL)));
+ EXPECT_EQ(1, GetSocketPoolGroupCount(
+ session->GetSSLSocketPool(HttpNetworkSession::WEBSOCKET_SOCKET_POOL)));
+ EXPECT_TRUE(waiter1.used_proxy_info().is_direct());
+}
+
+// TODO(ricea): Re-enable once WebSocket-over-SPDY is implemented.
+TEST_P(HttpStreamFactoryTest, DISABLED_RequestWebSocketSpdyHandshakeStream) {
SpdySessionDependencies session_deps(GetParam(),
ProxyService::CreateDirect());
@@ -1207,7 +1264,8 @@ TEST_P(HttpStreamFactoryTest, RequestWebSocketSpdyHandshakeStream) {
EXPECT_TRUE(waiter1.used_proxy_info().is_direct());
}
-TEST_P(HttpStreamFactoryTest, OrphanedWebSocketStream) {
+// TODO(ricea): Re-enable once WebSocket over SPDY is implemented.
+TEST_P(HttpStreamFactoryTest, DISABLED_OrphanedWebSocketStream) {
UseAlternateProtocolsScopedSetter use_alternate_protocols(true);
SpdySessionDependencies session_deps(GetParam(),
ProxyService::CreateDirect());