The WS protocols should be case sensitive, not insensitive

This commit is contained in:
Bastien Orivel 2018-08-16 14:37:18 +02:00
parent 89ab110357
commit 75c746655c
2 changed files with 3 additions and 14 deletions

View file

@ -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(())
}

View file

@ -1,11 +0,0 @@
[011.html]
type: testharness
[WebSockets: protocol mismatch]
expected: FAIL
[011.html?wss]
type: testharness
[WebSockets: protocol mismatch]
expected: FAIL