Auto merge of #21436 - Eijebong:ws-protocols, r=jdm

The WS protocols should be case sensitive, not insensitive

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21436)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-08-16 10:19:20 -04:00 committed by GitHub
commit cfae377660
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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