Commit e1d67670 authored by ricea's avatar ricea Committed by Commit bot

WebSocket header continuations test case.

The old WebSocket implementation did not support header
continuations. The new implementation does. Add a regression test so
that we do not regress the fix accidentally.

TEST=net_unittests
BUG=169448

Review URL: https://codereview.chromium.org/1005113002

Cr-Commit-Position: refs/heads/master@{#321326}
parent e5ad3135
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# The purpose of this test is to verify that WebSocket supports header
# continuations, as deprecated in RFC7230 section 3.2.4.
# It is used by test case WebSocketEndToEndTest.HeaderContinuations.
from mod_pywebsocket import handshake
from mod_pywebsocket.handshake.hybi import compute_accept
def web_socket_do_extra_handshake(request):
accept = compute_accept(request.headers_in['Sec-WebSocket-Key'])[0]
message = ('HTTP/1.1 101 Switching Protocols\r\n'
'Upgrade: websocket\r\n'
'Connection: Upgrade\r\n'
'Sec-WebSocket-Accept: %s\r\n'
'Sec-WebSocket-Extensions: permessage-deflate;\r\n'
' server_max_window_bits=10\r\n'
'\r\n' % accept)
request.connection.write(message)
# Prevent pywebsocket from sending its own handshake message.
raise handshake.AbortedByUserException('Close the connection')
def web_socket_transfer_data(request):
pass
......@@ -470,6 +470,24 @@ TEST_F(WebSocketEndToEndTest, DISABLED_ON_ANDROID(TrailingWhitespace)) {
EXPECT_EQ("sip", event_interface_->selected_subprotocol());
}
// This is a regression test for crbug.com/169448 "WebSockets should support
// header continuations"
// TODO(ricea): HTTP continuation headers have been deprecated by RFC7230. If
// support for continuation headers is removed from Chrome, then this test will
// break and should be removed.
TEST_F(WebSocketEndToEndTest, DISABLED_ON_ANDROID(HeaderContinuations)) {
SpawnedTestServer ws_server(SpawnedTestServer::TYPE_WS,
SpawnedTestServer::kLocalhost,
GetWebSocketTestDataDirectory());
ASSERT_TRUE(ws_server.Start());
GURL ws_url = ws_server.GetURL("header-continuation");
EXPECT_TRUE(ConnectAndWait(ws_url));
EXPECT_EQ("permessage-deflate; server_max_window_bits=10",
event_interface_->extensions());
}
} // namespace
} // namespace net
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment