From 16a33df195a04c3362f983c2b2d7d8d0b6c34788 Mon Sep 17 00:00:00 2001 From: Yan Date: Fri, 8 May 2020 15:58:55 +0800 Subject: [PATCH] fix ws subportocol lowercase header --- src/handshake/client.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/handshake/client.rs b/src/handshake/client.rs index c1721f5..1f57952 100644 --- a/src/handshake/client.rs +++ b/src/handshake/client.rs @@ -135,7 +135,12 @@ fn generate_request(request: Request, key: &str) -> Result> { key = key ) .unwrap(); + for (k, v) in request.headers() { + let mut k = k.as_str(); + if k == "sec-websocket-protocol".to_string(){ + k = "Sec-WebSocket-Protocol"; + } writeln!(req, "{}: {}\r", k, v.to_str()?).unwrap(); } writeln!(req, "\r").unwrap();