Skip to content

Commit

Permalink
Make the WebSocket handshake ourselves to ease switching libs
Browse files Browse the repository at this point in the history
We need to switch to tungstenite to finally update openssl, this commit
rewrites the whole websocket infrastructure to properly follow the Fetch
spec and to make switching to a different websocket library easier.
  • Loading branch information
nox committed Mar 29, 2017
1 parent 3ed32f8 commit d022535
Show file tree
Hide file tree
Showing 5 changed files with 561 additions and 71 deletions.
2 changes: 1 addition & 1 deletion components/net/fetch/methods.rs
Expand Up @@ -527,7 +527,7 @@ fn is_null_body_status(status: &Option<StatusCode>) -> bool {
}

/// https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-nosniff?
fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &Headers) -> bool {
pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &Headers) -> bool {
/// https://fetch.spec.whatwg.org/#x-content-type-options-header
/// This is needed to parse `X-Content-Type-Options` according to spec,
/// which requires that we inspect only the first value.
Expand Down
2 changes: 1 addition & 1 deletion components/net/http_loader.rs
Expand Up @@ -1359,7 +1359,7 @@ fn response_needs_revalidation(_response: &Response) -> bool {
}

/// https://fetch.spec.whatwg.org/#redirect-status
fn is_redirect_status(status: StatusCode) -> bool {
pub fn is_redirect_status(status: StatusCode) -> bool {
match status {
StatusCode::MovedPermanently |
StatusCode::Found |
Expand Down
5 changes: 4 additions & 1 deletion components/net/resource_thread.rs
Expand Up @@ -355,6 +355,9 @@ impl CoreResourceManager {
connect: WebSocketCommunicate,
connect_data: WebSocketConnectData,
resource_grp: &ResourceGroup) {
websocket_loader::init(connect, connect_data, resource_grp.cookie_jar.clone());
websocket_loader::init(connect,
connect_data,
resource_grp.cookie_jar.clone(),
resource_grp.ssl_context.clone());
}
}

0 comments on commit d022535

Please sign in to comment.