From 5e50387596d58597803cd6b048e05532fc780417 Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Thu, 25 Apr 2013 18:54:48 -0500 Subject: [PATCH] adjusts some hybi00 handshake settings --- websocketpp/processors/hybi00.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/websocketpp/processors/hybi00.hpp b/websocketpp/processors/hybi00.hpp index 86976510a6..e46a5bab86 100644 --- a/websocketpp/processors/hybi00.hpp +++ b/websocketpp/processors/hybi00.hpp @@ -124,7 +124,7 @@ public: md5::md5_hash_string(std::string(key_final,16)) ); - res.append_header("Upgrade","websocket"); + res.append_header("Upgrade","WebSocket"); res.append_header("Connection","Upgrade"); // Echo back client's origin unless our local application set a @@ -140,6 +140,10 @@ public: res.append_header("Sec-WebSocket-Location",uri->str()); } + if (subprotocol != "") { + res.replace_header("Sec-WebSocket-Protocol",subprotocol); + } + return lib::error_code(); } @@ -157,7 +161,9 @@ public: } std::string get_raw(const response_type& res) const { - return res.raw() + res.get_header("Sec-WebSocket-Key3"); + response_type temp = res; + temp.remove_header("Sec-WebSocket-Key3"); + return temp.raw() + res.get_header("Sec-WebSocket-Key3"); } const std::string& get_origin(const request_type& r) const {