28#define BOOST_TEST_MODULE processors
29#include <boost/test/unit_test.hpp>
40 std::string handshake =
"GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: upgrade\r\nUpgrade: websocket\r\n\r\n";
42 r.consume(handshake.c_str(),handshake.size());
50 std::string handshake =
"GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n\r\n";
52 r.consume(handshake.c_str(),handshake.size());
60 std::string handshake =
"GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: UpGrAde\r\nUpgrade: WebSocket\r\n\r\n";
62 r.consume(handshake.c_str(),handshake.size());
70 std::string handshake =
"GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: upgrade,foo\r\nUpgrade: websocket,foo\r\n\r\n";
72 r.consume(handshake.c_str(),handshake.size());
80 std::string handshake =
"GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: keep-alive,Upgrade,foo\r\nUpgrade: foo,websocket,bar\r\n\r\n";
82 r.consume(handshake.c_str(),handshake.size());
90 std::string handshake =
"GET / HTTP/1.1\r\nHost: www.example.com\r\nUpgrade: websocket\r\n\r\n";
92 r.consume(handshake.c_str(),handshake.size());
100 std::string handshake =
"GET / HTTP/1.1\r\nHost: www.example.com\r\nUpgrade: websocket\r\nSec-WebSocket-Version: 7\r\n\r\n";
102 r.consume(handshake.c_str(),handshake.size());
110 std::string handshake =
"GET / HTTP/1.1\r\nHost: www.example.com\r\nUpgrade: websocket\r\nSec-WebSocket-Version: 8\r\n\r\n";
112 r.consume(handshake.c_str(),handshake.size());
120 std::string handshake =
"GET / HTTP/1.1\r\nHost: www.example.com\r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\n\r\n";
122 r.consume(handshake.c_str(),handshake.size());
130 std::string handshake =
"GET / HTTP/1.1\r\nHost: www.example.com\r\nUpgrade: websocket\r\nSec-WebSocket-Version: abc\r\n\r\n";
132 r.consume(handshake.c_str(),handshake.size());
Stores, parses, and manipulates HTTP requests.
int get_websocket_version(request_type &r)
Extract the version from a WebSocket handshake request.
bool is_websocket_handshake(request_type &r)
Determine whether or not a generic HTTP request is a WebSocket handshake.
BOOST_AUTO_TEST_CASE(exact_match)