aboutsummaryrefslogtreecommitdiffstats
path: root/amalgamate
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2016-09-15 17:30:21 +0900
committeripknHama <ipknhama@gmail.com>2016-09-15 17:30:21 +0900
commit8b04940d2f28290451db439ad29155a0b8771ba3 (patch)
tree59556b8d00774f3a480c36976754a4e45807dc08 /amalgamate
parent7af78aff5ac1f0a76d3aa62f08e642558d8e58fc (diff)
downloadcrow-8b04940d2f28290451db439ad29155a0b8771ba3.tar.gz
crow-8b04940d2f28290451db439ad29155a0b8771ba3.zip
Upgrade amalgamate
Diffstat (limited to 'amalgamate')
-rw-r--r--amalgamate/crow_all.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/amalgamate/crow_all.h b/amalgamate/crow_all.h
index e606b32..27c15f2 100644
--- a/amalgamate/crow_all.h
+++ b/amalgamate/crow_all.h
@@ -6397,6 +6397,7 @@ namespace crow
#pragma once
+#include <boost/algorithm/string/predicate.hpp>
@@ -6442,7 +6443,7 @@ namespace crow
std::function<void(crow::websocket::connection&)> error_handler)
: adaptor_(std::move(adaptor)), open_handler_(std::move(open_handler)), message_handler_(std::move(message_handler)), close_handler_(std::move(close_handler)), error_handler_(std::move(error_handler))
{
- if (req.get_header_value("upgrade") != "websocket")
+ if (!boost::iequals(req.get_header_value("upgrade"), "websocket"))
{
adaptor.close();
delete this;
@@ -6532,13 +6533,13 @@ namespace crow
else if (size < 0x10000)
{
buf[1] += 126;
- *(uint16_t*)(buf+2) = (uint16_t)size;
+ *(uint16_t*)(buf+2) = htons((uint16_t)size);
return {buf, buf+4};
}
else
{
buf[1] += 127;
- *(uint64_t*)(buf+2) = (uint64_t)size;
+ *(uint64_t*)(buf+2) = ((1==htonl(1)) ? (uint64_t)size : ((uint64_t)htonl((size) & 0xFFFFFFFF) << 32) | htonl((size) >> 32));
return {buf, buf+10};
}
}