Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: net/server/http_server_unittest.cc

Issue 2640363004: HttpServer WebSocket: don't crash on data before server handshake (Closed)
Patch Set: Apply review feedback. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/server/web_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/server/http_server_unittest.cc
diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc
index 0875a5a9be36ac5ad38fcf4e28e2d64c22dd2a9b..a9168c913742a0c133c80140de6f5c02d7f98a0e 100644
--- a/net/server/http_server_unittest.cc
+++ b/net/server/http_server_unittest.cc
@@ -468,6 +468,20 @@ TEST_F(WebSocketTest, RequestWebSocket) {
ASSERT_TRUE(RunUntilRequestsReceived(1));
}
+TEST_F(WebSocketTest, RequestWebSocketTrailingJunk) {
+ TestHttpClient client;
+ ASSERT_THAT(client.ConnectAndWait(server_address_), IsOk());
+ client.Send(
+ "GET /test HTTP/1.1\r\n"
+ "Upgrade: WebSocket\r\n"
+ "Connection: SomethingElse, Upgrade\r\n"
+ "Sec-WebSocket-Version: 8\r\n"
+ "Sec-WebSocket-Key: key\r\n"
+ "\r\nHello? Anyone");
+ ASSERT_TRUE(RunUntilConnectionIdClosed(1));
+ client.ExpectUsedThenDisconnectedWithNoData();
+}
+
TEST_F(HttpServerTest, RequestWithTooLargeBody) {
class TestURLFetcherDelegate : public URLFetcherDelegate {
public:
« no previous file with comments | « no previous file | net/server/web_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698