mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix HSTS
This commit is contained in:
parent
267ce462d8
commit
68ebecb775
8 changed files with 254 additions and 16 deletions
|
@ -100,6 +100,12 @@ impl<'a> Handler for Client<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
self.http_state
|
||||
.hsts_list
|
||||
.write()
|
||||
.unwrap()
|
||||
.update_hsts_list_from_response(self.resource_url, &headers);
|
||||
|
||||
let _ = self
|
||||
.event_sender
|
||||
.send(WebSocketNetworkEvent::ConnectionEstablished {
|
||||
|
@ -185,6 +191,7 @@ pub fn init(
|
|||
thread::Builder::new()
|
||||
.name(format!("WebSocket connection to {}", req_builder.url))
|
||||
.spawn(move || {
|
||||
let mut req_builder = req_builder;
|
||||
let protocols = match req_builder.mode {
|
||||
RequestMode::WebSocket { protocols } => protocols,
|
||||
_ => panic!(
|
||||
|
@ -192,6 +199,16 @@ pub fn init(
|
|||
),
|
||||
};
|
||||
|
||||
// https://fetch.spec.whatwg.org/#websocket-opening-handshake
|
||||
// By standard, we should work with an http(s):// URL (req_url),
|
||||
// but as ws-rs expects to be called with a ws(s):// URL (net_url)
|
||||
// we upgrade ws to wss, so we don't have to convert http(s) back to ws(s).
|
||||
http_state
|
||||
.hsts_list
|
||||
.read()
|
||||
.unwrap()
|
||||
.apply_hsts_rules(&mut req_builder.url);
|
||||
|
||||
let scheme = req_builder.url.scheme();
|
||||
let mut req_url = req_builder.url.clone();
|
||||
if scheme == "ws" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue