| 99 | |
| 100 | template<class Api> |
| 101 | void |
| 102 | testMatrix(Api api) |
| 103 | { |
| 104 | net::io_context ioc; |
| 105 | |
| 106 | // request in stream |
| 107 | fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws) |
| 108 | { |
| 109 | ws.next_layer().append( |
| 110 | "GET / HTTP/1.1\r\n" |
| 111 | "Host: localhost\r\n" |
| 112 | "Upgrade: websocket\r\n" |
| 113 | "Connection: upgrade\r\n" |
| 114 | "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" |
| 115 | "Sec-WebSocket-Version: 13\r\n" |
| 116 | "\r\n"); |
| 117 | ws.next_layer().read_size(20); |
| 118 | api.accept(ws); |
| 119 | }); |
| 120 | |
| 121 | // request in stream, decorator |
| 122 | fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws) |
| 123 | { |
| 124 | ws.next_layer().append( |
| 125 | "GET / HTTP/1.1\r\n" |
| 126 | "Host: localhost\r\n" |
| 127 | "Upgrade: websocket\r\n" |
| 128 | "Connection: upgrade\r\n" |
| 129 | "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" |
| 130 | "Sec-WebSocket-Version: 13\r\n" |
| 131 | "\r\n"); |
| 132 | ws.next_layer().read_size(20); |
| 133 | bool called = false; |
| 134 | ws.set_option(stream_base::decorator( |
| 135 | res_decorator{called})); |
| 136 | api.accept(ws); |
| 137 | BEAST_EXPECT(called); |
| 138 | }); |
| 139 | |
| 140 | // request in buffers |
| 141 | fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws) |
| 142 | { |
| 143 | api.accept(ws, sbuf( |
| 144 | "GET / HTTP/1.1\r\n" |
| 145 | "Host: localhost\r\n" |
| 146 | "Upgrade: websocket\r\n" |
| 147 | "Connection: upgrade\r\n" |
| 148 | "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" |
| 149 | "Sec-WebSocket-Version: 13\r\n" |
| 150 | "\r\n" |
| 151 | )); |
| 152 | }); |
| 153 | |
| 154 | // request in buffers, decorator |
| 155 | fail_loop([&](stream<test::basic_stream<net::io_context::executor_type>>& ws) |
| 156 | { |
| 157 | bool called = false; |
| 158 | ws.set_option(stream_base::decorator( |