Skip to content

Commit

Permalink
fixed HTTP headers case sensitivity issue, separated WSStreamParser f…
Browse files Browse the repository at this point in the history
…or upcoming WSClient
  • Loading branch information
Pavel Kraynyukhov committed Aug 20, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 0afbe0a commit ed68dd7
Showing 4 changed files with 421 additions and 374 deletions.
8 changes: 4 additions & 4 deletions include/Shakespeer.h
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@
#include <ePoll.h>
#include <Config.h>
#include <ApplicationRegistry.h>
#include <missing.h>

static const std::vector<uint8_t> forbidden{'H','T','T','P','/','1','.','1',' ','4','0','3',' ','F','o','r','b','i','d','d','e','n'};

@@ -152,8 +153,8 @@ namespace LAppS
{
mHTTPRParser.parse(headerBuffer,bufflen);
bool arhap=true;
arhap=arhap&&(mHTTPRParser["Connection"]=="Upgrade");
arhap=arhap&&(mHTTPRParser["Upgrade"]=="websocket");
arhap=arhap&&(itc::utils::toupper(mHTTPRParser["Connection"])==itc::utils::toupper("UPGRADE"));
arhap=arhap&&(itc::utils::toupper(mHTTPRParser["Upgrade"])==itc::utils::toupper("WEBSOCKET"));
arhap=arhap&&(mHTTPRParser["Sec-WebSocket-Version"]=="13");
arhap=arhap&&(!mHTTPRParser["Sec-WebSocket-Key"].empty());

@@ -212,10 +213,9 @@ namespace LAppS
std::string proto_alias=it.value();
allow_protocols.append(proto_alias);
allow_protocols.append("\r\n");
okResponse.append(allow_protocols);
}

okResponse.append(allow_protocols);

okResponse.append("Sec-WebSocket-Accept: ");

response.resize(okResponse.length());
Loading

0 comments on commit ed68dd7

Please sign in to comment.