diff options
author | ricea <ricea@chromium.org> | 2015-02-02 05:35:13 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-02 13:37:21 +0000 |
commit | 23c3f94ffbf774f240fbc52c08760b0e3d90964b (patch) | |
tree | 8a11af221d635d6a6402bb63770f8210d2508c14 /net/websockets/websocket_end_to_end_test.cc | |
parent | ac1aaf963cfedf830afce10e2bfe1a9504bd49d3 (diff) | |
download | chromium_src-23c3f94ffbf774f240fbc52c08760b0e3d90964b.zip chromium_src-23c3f94ffbf774f240fbc52c08760b0e3d90964b.tar.gz chromium_src-23c3f94ffbf774f240fbc52c08760b0e3d90964b.tar.bz2 |
Avoid WebSocket upgrade on network error.
In the event of network error, the WebSocket server response is not
validated. However, some network errors are ignored higher up in the
stack.
For example, in HttpNetworkTransaction::DoReadHeadersComplete at
http_network_transaction.cc:988, ERR_CONNECTION_CLOSED is converted to
OK.
To avoid this whole class of bugs, do not keep status code 101
(Switching Protocols) if there was a network error. It is changed to
503.
The response headers that are displayed in devtools are copied before
the change, so they will still retain the original status code.
BUG=408061
TEST=net_unittests
Review URL: https://codereview.chromium.org/889783002
Cr-Commit-Position: refs/heads/master@{#314136}
Diffstat (limited to 'net/websockets/websocket_end_to_end_test.cc')
-rw-r--r-- | net/websockets/websocket_end_to_end_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/websockets/websocket_end_to_end_test.cc b/net/websockets/websocket_end_to_end_test.cc index 0b5944f..4aa2f1c 100644 --- a/net/websockets/websocket_end_to_end_test.cc +++ b/net/websockets/websocket_end_to_end_test.cc @@ -365,6 +365,19 @@ TEST_F(WebSocketEndToEndTest, DISABLED_ON_ANDROID(HttpsProxyUsed)) { EXPECT_TRUE(info.proxy_info.is_http()); } +// This is a regression test for crbug.com/408061 Crash in +// net::WebSocketBasicHandshakeStream::Upgrade. +TEST_F(WebSocketEndToEndTest, DISABLED_ON_ANDROID(TruncatedResponse)) { + SpawnedTestServer ws_server(SpawnedTestServer::TYPE_WS, + SpawnedTestServer::kLocalhost, + GetWebSocketTestDataDirectory()); + ASSERT_TRUE(ws_server.Start()); + InitialiseContext(); + + GURL ws_url = ws_server.GetURL("truncated-headers"); + EXPECT_FALSE(ConnectAndWait(ws_url)); +} + } // namespace } // namespace net |