From 609e6f3eaff3ed27cb194bd670cfec2a83819df3 Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Mon, 16 Jan 2012 11:18:16 -0600 Subject: [PATCH] better hixie 76 fix --- src/processors/hybi_legacy.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/processors/hybi_legacy.hpp b/src/processors/hybi_legacy.hpp index 35b26e1b2f..e2ed6902ec 100644 --- a/src/processors/hybi_legacy.hpp +++ b/src/processors/hybi_legacy.hpp @@ -59,8 +59,7 @@ public: } void handshake_response(const http::parser::request& request,http::parser::response& response) { - char key_final[17]; - key_final[16] = 0; + char key_final[16]; // copy key1 into final key *reinterpret_cast(&key_final[0]) = @@ -73,7 +72,7 @@ public: // copy key3 into final key memcpy(&key_final[8],request.header("Sec-WebSocket-Key3").c_str(),8); - m_key3 = md5_hash_string(key_final); + m_key3 = md5_hash_string(std::string(key_final,16)); response.add_header("Upgrade","websocket"); response.add_header("Connection","Upgrade");