#include <boost/test/unit_test.hpp>
#include <iostream>
#include <string>
#include <websocketpp/processors/processor.hpp>
#include <websocketpp/http/request.hpp>
Go to the source code of this file.
◆ BOOST_TEST_MODULE
#define BOOST_TEST_MODULE processors |
◆ BOOST_AUTO_TEST_CASE() [1/10]
BOOST_AUTO_TEST_CASE |
( |
ci_exact_match | | ) |
|
Definition at line 57 of file processor.cpp.
57 {
59
60 std::string handshake = "GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: UpGrAde\r\nUpgrade: WebSocket\r\n\r\n";
61
62 r.consume(handshake.c_str(),handshake.size());
63
65}
Stores, parses, and manipulates HTTP requests.
bool is_websocket_handshake(request_type &r)
Determine whether or not a generic HTTP request is a WebSocket handshake.
◆ BOOST_AUTO_TEST_CASE() [2/10]
BOOST_AUTO_TEST_CASE |
( |
exact_match | | ) |
|
Definition at line 37 of file processor.cpp.
37 {
39
40 std::string handshake = "GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: upgrade\r\nUpgrade: websocket\r\n\r\n";
41
42 r.consume(handshake.c_str(),handshake.size());
43
45}
◆ BOOST_AUTO_TEST_CASE() [3/10]
BOOST_AUTO_TEST_CASE |
( |
non_exact_match1 | | ) |
|
Definition at line 67 of file processor.cpp.
67 {
69
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";
71
72 r.consume(handshake.c_str(),handshake.size());
73
75}
◆ BOOST_AUTO_TEST_CASE() [4/10]
BOOST_AUTO_TEST_CASE |
( |
non_exact_match2 | | ) |
|
Definition at line 77 of file processor.cpp.
77 {
79
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";
81
82 r.consume(handshake.c_str(),handshake.size());
83
85}
◆ BOOST_AUTO_TEST_CASE() [5/10]
BOOST_AUTO_TEST_CASE |
( |
non_match | | ) |
|
Definition at line 47 of file processor.cpp.
47 {
49
50 std::string handshake = "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n\r\n";
51
52 r.consume(handshake.c_str(),handshake.size());
53
55}
◆ BOOST_AUTO_TEST_CASE() [6/10]
BOOST_AUTO_TEST_CASE |
( |
version_13 | | ) |
|
Definition at line 117 of file processor.cpp.
117 {
119
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";
121
122 r.consume(handshake.c_str(),handshake.size());
123
125}
int get_websocket_version(request_type &r)
Extract the version from a WebSocket handshake request.
◆ BOOST_AUTO_TEST_CASE() [7/10]
BOOST_AUTO_TEST_CASE |
( |
version_7 | | ) |
|
Definition at line 97 of file processor.cpp.
97 {
99
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";
101
102 r.consume(handshake.c_str(),handshake.size());
103
105}
◆ BOOST_AUTO_TEST_CASE() [8/10]
BOOST_AUTO_TEST_CASE |
( |
version_8 | | ) |
|
Definition at line 107 of file processor.cpp.
107 {
109
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";
111
112 r.consume(handshake.c_str(),handshake.size());
113
115}
◆ BOOST_AUTO_TEST_CASE() [9/10]
BOOST_AUTO_TEST_CASE |
( |
version_blank | | ) |
|
Definition at line 87 of file processor.cpp.
87 {
89
90 std::string handshake = "GET / HTTP/1.1\r\nHost: www.example.com\r\nUpgrade: websocket\r\n\r\n";
91
92 r.consume(handshake.c_str(),handshake.size());
93
95}
◆ BOOST_AUTO_TEST_CASE() [10/10]
BOOST_AUTO_TEST_CASE |
( |
version_non_numeric | | ) |
|
Definition at line 127 of file processor.cpp.
127 {
129
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";
131
132 r.consume(handshake.c_str(),handshake.size());
133
135}