From 75c746655cc1ae92d3841b92b2fe2d127a052de3 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Thu, 16 Aug 2018 14:37:18 +0200 Subject: [PATCH] The WS protocols should be case sensitive, not insensitive --- components/net/websocket_loader.rs | 6 +++--- .../wpt/metadata/websockets/constructor/011.html.ini | 11 ----------- 2 files changed, 3 insertions(+), 14 deletions(-) delete mode 100644 tests/wpt/metadata/websockets/constructor/011.html.ini diff --git a/components/net/websocket_loader.rs b/components/net/websocket_loader.rs index 2f6dcf5b768..5a676c904ad 100644 --- a/components/net/websocket_loader.rs +++ b/components/net/websocket_loader.rs @@ -109,14 +109,14 @@ impl<'a> Handler for Client<'a> { fn on_response(&mut self, res: &WsResponse) -> WebSocketResult<()> { let protocol_in_use = res.protocol()?; + if let Some(protocol_name) = protocol_in_use { - let protocol_name = protocol_name.to_lowercase(); - if !self.protocols.is_empty() && !self.protocols.iter().any(|p| protocol_name == (*p).to_lowercase()) { + if !self.protocols.is_empty() && !self.protocols.iter().any(|p| protocol_name == (*p)) { let error = WebSocketError::new(WebSocketErrorKind::Protocol, "Protocol in Use not in client-supplied protocol list"); return Err(error); } - self.protocol_in_use = Some(protocol_name); + self.protocol_in_use = Some(protocol_name.into()); } Ok(()) } diff --git a/tests/wpt/metadata/websockets/constructor/011.html.ini b/tests/wpt/metadata/websockets/constructor/011.html.ini deleted file mode 100644 index 01f80aa2dbe..00000000000 --- a/tests/wpt/metadata/websockets/constructor/011.html.ini +++ /dev/null @@ -1,11 +0,0 @@ -[011.html] - type: testharness - [WebSockets: protocol mismatch] - expected: FAIL - - -[011.html?wss] - type: testharness - [WebSockets: protocol mismatch] - expected: FAIL -