From 91c1e59ec45195658646825b790a8ec9e39b4d20 Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Thu, 28 Mar 2013 08:23:59 -0500 Subject: [PATCH] fixes a legacy/hybi00 handshake processing bug on 32 bit x86 --- websocketpp/processors/hybi00.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/websocketpp/processors/hybi00.hpp b/websocketpp/processors/hybi00.hpp index 79708011b6..1bd996a93d 100644 --- a/websocketpp/processors/hybi00.hpp +++ b/websocketpp/processors/hybi00.hpp @@ -28,6 +28,8 @@ #ifndef WEBSOCKETPP_PROCESSOR_HYBI00_HPP #define WEBSOCKETPP_PROCESSOR_HYBI00_HPP +#include + // For htonl #if defined(WIN32) #include @@ -109,7 +111,7 @@ public: std::copy(key3.c_str(), key3.c_str()+std::min(static_cast(8), key3.size()), &key_final[8]); - + res.append_header( "Sec-WebSocket-Key3", md5::md5_hash_string(std::string(key_final,16)) @@ -242,7 +244,7 @@ private: } } - num = atoi(digits.c_str()); + num = strtoul(digits.c_str(), NULL, 10); if (spaces > 0 && num > 0) { num = htonl(num/spaces); std::copy(reinterpret_cast(&num),