Skip to content

Commit

Permalink
Fix failing build after merge (#125)
Browse files Browse the repository at this point in the history
Co-authored-by: Benoît CORTIER <benoit.cortier@fried-world.eu>
  • Loading branch information
bcortier-devolutions and CBenoit authored Dec 9, 2020
1 parent 27b0821 commit 8f610c4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/websocket_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,18 @@ fn process_req(req: &Request<Body>) -> Response<Body> {
.unwrap();
};

let mut builder = Response::builder();

builder
let builder = Response::builder()
.status(StatusCode::SWITCHING_PROTOCOLS)
.header(header::UPGRADE, "websocket")
.header(header::CONNECTION, "upgrade")
.header(header::SEC_WEBSOCKET_ACCEPT, key.as_str());

// Add the SEC_WEBSOCKET_PROTOCOL header only if it was in the request, otherwise, IIS doesn't like it
if let Some(websocket_protocol) = req.headers().get(header::SEC_WEBSOCKET_PROTOCOL) {
builder.header(header::SEC_WEBSOCKET_PROTOCOL, websocket_protocol);
}
let builder = if let Some(websocket_protocol) = req.headers().get(header::SEC_WEBSOCKET_PROTOCOL) {
builder.header(header::SEC_WEBSOCKET_PROTOCOL, websocket_protocol)
} else {
builder
};

builder.body(Body::empty()).unwrap()
}
Expand Down

0 comments on commit 8f610c4

Please sign in to comment.