@@ -217,8 +217,8 @@ BOOST_AUTO_TEST_CASE( connection_extensions ) {
217
217
}
218
218
219
219
BOOST_AUTO_TEST_CASE ( basic_websocket_request ) {
220
- std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n Origin: http://www.example.com\r\n\r\n " ;
221
- std::string output = " HTTP/1.1 101 Switching Protocols\r\n Connection: upgrade \r\n Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n Server: " ;
220
+ std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: Upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n Origin: http://www.example.com\r\n\r\n " ;
221
+ std::string output = " HTTP/1.1 101 Switching Protocols\r\n Connection: Upgrade \r\n Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n Server: " ;
222
222
output+=websocketpp::user_agent;
223
223
output+=" \r\n Upgrade: websocket\r\n\r\n " ;
224
224
@@ -279,8 +279,8 @@ BOOST_AUTO_TEST_CASE( deferred_http_request ) {
279
279
}
280
280
281
281
BOOST_AUTO_TEST_CASE ( request_no_server_header ) {
282
- std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n Origin: http://www.example.com\r\n\r\n " ;
283
- std::string output = " HTTP/1.1 101 Switching Protocols\r\n Connection: upgrade \r\n Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n Upgrade: websocket\r\n\r\n " ;
282
+ std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: Upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n Origin: http://www.example.com\r\n\r\n " ;
283
+ std::string output = " HTTP/1.1 101 Switching Protocols\r\n Connection: Upgrade \r\n Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n Upgrade: websocket\r\n\r\n " ;
284
284
285
285
server s;
286
286
s.set_user_agent (" " );
@@ -290,8 +290,8 @@ BOOST_AUTO_TEST_CASE( request_no_server_header ) {
290
290
}
291
291
292
292
BOOST_AUTO_TEST_CASE ( request_no_server_header_override ) {
293
- std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n Origin: http://www.example.com\r\n\r\n " ;
294
- std::string output = " HTTP/1.1 101 Switching Protocols\r\n Connection: upgrade \r\n Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n Server: foo\r\n Upgrade: websocket\r\n\r\n " ;
293
+ std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: Upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n Origin: http://www.example.com\r\n\r\n " ;
294
+ std::string output = " HTTP/1.1 101 Switching Protocols\r\n Connection: Upgrade \r\n Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n Server: foo\r\n Upgrade: websocket\r\n\r\n " ;
295
295
296
296
server s;
297
297
s.set_user_agent (" " );
@@ -304,7 +304,7 @@ BOOST_AUTO_TEST_CASE( request_no_server_header_override ) {
304
304
BOOST_AUTO_TEST_CASE ( basic_client_websocket ) {
305
305
std::string uri = " ws://localhost" ;
306
306
307
- // std::string output = "HTTP/1.1 101 Switching Protocols\r\nConnection: upgrade \r\nSec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\nServer: foo\r\nUpgrade: websocket\r\n\r\n";
307
+ // std::string output = "HTTP/1.1 101 Switching Protocols\r\nConnection: Upgrade \r\nSec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\nServer: foo\r\nUpgrade: websocket\r\n\r\n";
308
308
309
309
std::string ref = " GET / HTTP/1.1\r\n Connection: Upgrade\r\n Foo: Bar\r\n Host: localhost\r\n Sec-WebSocket-Key: AAAAAAAAAAAAAAAAAAAAAA==\r\n Sec-WebSocket-Version: 13\r\n Upgrade: websocket\r\n User-Agent: foo\r\n\r\n " ;
310
310
@@ -326,13 +326,13 @@ BOOST_AUTO_TEST_CASE( basic_client_websocket ) {
326
326
}
327
327
328
328
BOOST_AUTO_TEST_CASE ( set_max_message_size ) {
329
- std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n\r\n " ;
329
+ std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: Upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n\r\n " ;
330
330
331
331
// After the handshake, add a single frame with a message that is too long.
332
332
char frame0[10 ] = {char (0x82 ), char (0x83 ), 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x01 , 0x01 };
333
333
input.append (frame0, 10 );
334
334
335
- std::string output = " HTTP/1.1 101 Switching Protocols\r\n Connection: upgrade \r\n Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n Server: foo\r\n Upgrade: websocket\r\n\r\n " ;
335
+ std::string output = " HTTP/1.1 101 Switching Protocols\r\n Connection: Upgrade \r\n Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n Server: foo\r\n Upgrade: websocket\r\n\r\n " ;
336
336
337
337
// After the handshake, add a single frame with a close message with message too big
338
338
// error code.
@@ -361,7 +361,7 @@ BOOST_AUTO_TEST_CASE( websocket_fail_parse_error ) {
361
361
}
362
362
363
363
BOOST_AUTO_TEST_CASE ( websocket_fail_invalid_version ) {
364
- std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: foo\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n Origin: http://www.example.com\r\n\r\n " ;
364
+ std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: Upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: foo\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n Origin: http://www.example.com\r\n\r\n " ;
365
365
366
366
server s;
367
367
websocketpp::lib::error_code ec = make_error_code (websocketpp::error::invalid_version);
@@ -373,7 +373,7 @@ BOOST_AUTO_TEST_CASE( websocket_fail_invalid_version ) {
373
373
}
374
374
375
375
BOOST_AUTO_TEST_CASE ( websocket_fail_unsupported_version ) {
376
- std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 12\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n Origin: http://www.example.com\r\n\r\n " ;
376
+ std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: Upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 12\r\n Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n Origin: http://www.example.com\r\n\r\n " ;
377
377
378
378
server s;
379
379
websocketpp::lib::error_code ec = make_error_code (websocketpp::error::unsupported_version);
@@ -385,7 +385,7 @@ BOOST_AUTO_TEST_CASE( websocket_fail_unsupported_version ) {
385
385
}
386
386
387
387
// BOOST_AUTO_TEST_CASE( websocket_fail_invalid_uri ) {
388
- // std::string input = "GET http://345.123.123.123/foo HTTP/1.1\r\nHost: www.example.com\r\nConnection: upgrade \r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nOrigin: http://www.example.com\r\n\r\n";
388
+ // std::string input = "GET http://345.123.123.123/foo HTTP/1.1\r\nHost: www.example.com\r\nConnection: Upgrade \r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nOrigin: http://www.example.com\r\n\r\n";
389
389
390
390
// server s;
391
391
// websocketpp::lib::error_code ec = make_error_code(websocketpp::error::unsupported_version);
@@ -429,14 +429,14 @@ BOOST_AUTO_TEST_CASE( websocket_fail_upgrade_required ) {
429
429
430
430
431
431
// BOOST_AUTO_TEST_CASE( user_reject_origin ) {
432
- // std::string input = "GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: upgrade \r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nOrigin: http://www.example2.com\r\n\r\n";
432
+ // std::string input = "GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: Upgrade \r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nOrigin: http://www.example2.com\r\n\r\n";
433
433
// std::string output = "HTTP/1.1 403 Forbidden\r\nServer: "+websocketpp::USER_AGENT+"\r\n\r\n";
434
434
435
435
// BOOST_CHECK(run_server_test(input) == output);
436
436
// }
437
437
438
438
// BOOST_AUTO_TEST_CASE( basic_text_message ) {
439
- // std::string input = "GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: upgrade \r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nOrigin: http://www.example.com\r\n\r\n";
439
+ // std::string input = "GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: Upgrade \r\nUpgrade: websocket\r\nSec-WebSocket-Version: 13\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nOrigin: http://www.example.com\r\n\r\n";
440
440
441
441
// unsigned char frames[8] = {0x82,0x82,0xFF,0xFF,0xFF,0xFF,0xD5,0xD5};
442
442
// input.append(reinterpret_cast<char*>(frames),8);
@@ -481,7 +481,7 @@ BOOST_AUTO_TEST_CASE( client_handshake_timeout_race2 ) {
481
481
482
482
BOOST_CHECK (!ec);
483
483
484
- std::string output = " HTTP/1.1 101 Switching Protocols\r\n Connection: upgrade \r\n Sec-WebSocket-Accept: ICX+Yqv66kxgM0FcWaLWlFLwTAI=\r\n Server: foo\r\n Upgrade: websocket\r\n\r\n " ;
484
+ std::string output = " HTTP/1.1 101 Switching Protocols\r\n Connection: Upgrade \r\n Sec-WebSocket-Accept: ICX+Yqv66kxgM0FcWaLWlFLwTAI=\r\n Server: foo\r\n Upgrade: websocket\r\n\r\n " ;
485
485
486
486
// This test the case where a handshake times out immediately before the
487
487
// handler that would have completed it gets invoked. This situation happens
@@ -501,7 +501,7 @@ BOOST_AUTO_TEST_CASE( client_handshake_timeout_race2 ) {
501
501
BOOST_AUTO_TEST_CASE ( server_handshake_timeout_race1 ) {
502
502
debug_server s;
503
503
504
- std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: AAAAAAAAAAAAAAAAAAAAAA==\r\n\r\n " ;
504
+ std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: Upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: AAAAAAAAAAAAAAAAAAAAAA==\r\n\r\n " ;
505
505
506
506
debug_server::connection_ptr con = s.get_connection ();
507
507
con->start ();
@@ -516,7 +516,7 @@ BOOST_AUTO_TEST_CASE( server_handshake_timeout_race1 ) {
516
516
BOOST_AUTO_TEST_CASE ( server_handshake_timeout_race2 ) {
517
517
debug_server s;
518
518
519
- std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: AAAAAAAAAAAAAAAAAAAAAA==\r\n\r\n " ;
519
+ std::string input = " GET / HTTP/1.1\r\n Host: www.example.com\r\n Connection: Upgrade \r\n Upgrade: websocket\r\n Sec-WebSocket-Version: 13\r\n Sec-WebSocket-Key: AAAAAAAAAAAAAAAAAAAAAA==\r\n\r\n " ;
520
520
521
521
debug_server::connection_ptr con = s.get_connection ();
522
522
con->start ();
0 commit comments