#include <boost/test/unit_test.hpp>
#include <iostream>
#include <string>
#include <websocketpp/processors/hybi13.hpp>
#include <websocketpp/http/request.hpp>
#include <websocketpp/http/response.hpp>
#include <websocketpp/message_buffer/message.hpp>
#include <websocketpp/message_buffer/alloc.hpp>
#include <websocketpp/random/none.hpp>
#include <websocketpp/extensions/permessage_deflate/disabled.hpp>
#include <websocketpp/extensions/permessage_deflate/enabled.hpp>
Go to the source code of this file.
Classes | |
struct | stub_config |
struct | stub_config::permessage_deflate_config |
Extension specific config. More... | |
struct | stub_config_ext |
struct | stub_config_ext::permessage_deflate_config |
struct | processor_setup |
struct | processor_setup_ext |
Macros | |
#define | BOOST_TEST_MODULE hybi_13_processor |
Typedefs | |
typedef stub_config::con_msg_manager_type | con_msg_manager_type |
typedef stub_config::message_type::ptr | message_ptr |
Functions | |
BOOST_AUTO_TEST_CASE (exact_match) | |
BOOST_AUTO_TEST_CASE (non_get_method) | |
BOOST_AUTO_TEST_CASE (old_http_version) | |
BOOST_AUTO_TEST_CASE (missing_handshake_key1) | |
BOOST_AUTO_TEST_CASE (missing_handshake_key2) | |
BOOST_AUTO_TEST_CASE (bad_host) | |
BOOST_AUTO_TEST_CASE (frame_empty_binary_unmasked) | |
BOOST_AUTO_TEST_CASE (frame_small_binary_unmasked) | |
BOOST_AUTO_TEST_CASE (frame_extended_binary_unmasked) | |
BOOST_AUTO_TEST_CASE (frame_jumbo_binary_unmasked) | |
BOOST_AUTO_TEST_CASE (control_frame_too_large) | |
BOOST_AUTO_TEST_CASE (rsv_bits_used) | |
BOOST_AUTO_TEST_CASE (reserved_opcode_used) | |
BOOST_AUTO_TEST_CASE (fragmented_control_message) | |
BOOST_AUTO_TEST_CASE (fragmented_binary_message) | |
BOOST_AUTO_TEST_CASE (unmasked_client_frame) | |
BOOST_AUTO_TEST_CASE (masked_server_frame) | |
BOOST_AUTO_TEST_CASE (frame_small_binary_masked) | |
BOOST_AUTO_TEST_CASE (masked_fragmented_binary_message) | |
BOOST_AUTO_TEST_CASE (prepare_data_frame) | |
BOOST_AUTO_TEST_CASE (single_frame_message_too_large) | |
BOOST_AUTO_TEST_CASE (multiple_frame_message_too_large) | |
BOOST_AUTO_TEST_CASE (client_handshake_request) | |
BOOST_AUTO_TEST_CASE (client_handshake_response_404) | |
BOOST_AUTO_TEST_CASE (client_handshake_response_no_upgrade) | |
BOOST_AUTO_TEST_CASE (client_handshake_response_no_connection) | |
BOOST_AUTO_TEST_CASE (client_handshake_response_no_accept) | |
BOOST_AUTO_TEST_CASE (client_handshake_response) | |
BOOST_AUTO_TEST_CASE (extensions_disabled) | |
BOOST_AUTO_TEST_CASE (extension_negotiation_blank) | |
BOOST_AUTO_TEST_CASE (extension_negotiation_unknown) | |
BOOST_AUTO_TEST_CASE (extract_subprotocols_empty) | |
BOOST_AUTO_TEST_CASE (extract_subprotocols_one) | |
BOOST_AUTO_TEST_CASE (extract_subprotocols_multiple) | |
BOOST_AUTO_TEST_CASE (extract_subprotocols_invalid) | |
BOOST_AUTO_TEST_CASE (extension_negotiation_permessage_deflate) | |
#define BOOST_TEST_MODULE hybi_13_processor |
Definition at line 28 of file hybi13.cpp.
Definition at line 89 of file hybi13.cpp.
typedef stub_config::message_type::ptr message_ptr |
Definition at line 90 of file hybi13.cpp.
BOOST_AUTO_TEST_CASE | ( | exact_match | ) |
Definition at line 120 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::get_uri(), websocketpp::processor::hybi00< config >::get_version(), websocketpp::processor::get_websocket_version(), websocketpp::processor::is_websocket_handshake(), processor_setup::p, websocketpp::processor::hybi00< config >::process_handshake(), processor_setup::req, processor_setup::res, websocketpp::uri_default_port, and websocketpp::processor::hybi00< config >::validate_handshake().
BOOST_AUTO_TEST_CASE | ( | non_get_method | ) |
Definition at line 147 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::get_version(), websocketpp::processor::get_websocket_version(), websocketpp::processor::error::invalid_http_method, websocketpp::processor::is_websocket_handshake(), processor_setup::p, processor_setup::req, and websocketpp::processor::hybi00< config >::validate_handshake().
BOOST_AUTO_TEST_CASE | ( | old_http_version | ) |
Definition at line 159 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::get_version(), websocketpp::processor::get_websocket_version(), websocketpp::processor::error::invalid_http_version, websocketpp::processor::is_websocket_handshake(), processor_setup::p, processor_setup::req, and websocketpp::processor::hybi00< config >::validate_handshake().
BOOST_AUTO_TEST_CASE | ( | missing_handshake_key1 | ) |
Definition at line 171 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::get_version(), websocketpp::processor::get_websocket_version(), websocketpp::processor::is_websocket_handshake(), websocketpp::processor::error::missing_required_header, processor_setup::p, processor_setup::req, and websocketpp::processor::hybi00< config >::validate_handshake().
BOOST_AUTO_TEST_CASE | ( | missing_handshake_key2 | ) |
Definition at line 183 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::get_version(), websocketpp::processor::get_websocket_version(), websocketpp::processor::is_websocket_handshake(), websocketpp::processor::error::missing_required_header, processor_setup::p, processor_setup::req, and websocketpp::processor::hybi00< config >::validate_handshake().
BOOST_AUTO_TEST_CASE | ( | bad_host | ) |
Definition at line 195 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::get_uri(), websocketpp::processor::hybi00< config >::get_version(), websocketpp::processor::get_websocket_version(), websocketpp::processor::is_websocket_handshake(), processor_setup::p, processor_setup::req, and websocketpp::processor::hybi00< config >::validate_handshake().
BOOST_AUTO_TEST_CASE | ( | frame_empty_binary_unmasked | ) |
Definition at line 222 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | frame_small_binary_unmasked | ) |
Definition at line 246 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | frame_extended_binary_unmasked | ) |
Definition at line 263 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | frame_jumbo_binary_unmasked | ) |
Definition at line 284 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | control_frame_too_large | ) |
Definition at line 301 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), websocketpp::processor::error::control_too_big, processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | rsv_bits_used | ) |
Definition at line 313 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), websocketpp::processor::error::invalid_rsv_bit, processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | reserved_opcode_used | ) |
Definition at line 329 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), websocketpp::processor::error::invalid_opcode, processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | fragmented_control_message | ) |
Definition at line 351 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::error::fragmented_control, websocketpp::processor::hybi00< config >::get_message(), processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | fragmented_binary_message | ) |
Definition at line 362 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), websocketpp::processor::error::invalid_continuation, processor_setup::p, websocketpp::frame::opcode::PING, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | unmasked_client_frame | ) |
Definition at line 410 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), websocketpp::processor::error::masking_required, processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | masked_server_frame | ) |
Definition at line 421 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), websocketpp::processor::error::masking_forbidden, processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | frame_small_binary_masked | ) |
Definition at line 432 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | masked_fragmented_binary_message | ) |
Definition at line 444 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::hybi00< config >::get_message(), processor_setup::p, and websocketpp::processor::hybi00< config >::ready().
BOOST_AUTO_TEST_CASE | ( | prepare_data_frame | ) |
Definition at line 458 of file hybi13.cpp.
References processor_setup::ec, websocketpp::close::status::invalid(), websocketpp::processor::error::invalid_arguments, websocketpp::processor::error::invalid_opcode, websocketpp::frame::opcode::is_control(), processor_setup::msg_manager, processor_setup::p, and websocketpp::processor::hybi00< config >::prepare_data_frame().
BOOST_AUTO_TEST_CASE | ( | single_frame_message_too_large | ) |
Definition at line 494 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::error::message_too_big, processor_setup::p, and websocketpp::processor::processor< config >::set_max_message_size().
BOOST_AUTO_TEST_CASE | ( | multiple_frame_message_too_large | ) |
Definition at line 506 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::consume(), processor_setup::ec, websocketpp::processor::error::message_too_big, processor_setup::p, and websocketpp::processor::processor< config >::set_max_message_size().
BOOST_AUTO_TEST_CASE | ( | client_handshake_request | ) |
Definition at line 525 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::client_handshake_request(), processor_setup::p, and processor_setup::req.
BOOST_AUTO_TEST_CASE | ( | client_handshake_response_404 | ) |
Definition at line 557 of file hybi13.cpp.
References websocketpp::processor::error::invalid_http_status, processor_setup::p, processor_setup::req, processor_setup::res, and websocketpp::processor::hybi00< config >::validate_server_handshake_response().
BOOST_AUTO_TEST_CASE | ( | client_handshake_response_no_upgrade | ) |
Definition at line 566 of file hybi13.cpp.
References websocketpp::processor::error::missing_required_header, processor_setup::p, processor_setup::req, processor_setup::res, and websocketpp::processor::hybi00< config >::validate_server_handshake_response().
BOOST_AUTO_TEST_CASE | ( | client_handshake_response_no_connection | ) |
Definition at line 575 of file hybi13.cpp.
References websocketpp::processor::error::missing_required_header, processor_setup::p, processor_setup::req, processor_setup::res, and websocketpp::processor::hybi00< config >::validate_server_handshake_response().
BOOST_AUTO_TEST_CASE | ( | client_handshake_response_no_accept | ) |
Definition at line 584 of file hybi13.cpp.
References websocketpp::processor::error::missing_required_header, processor_setup::p, processor_setup::req, processor_setup::res, and websocketpp::processor::hybi00< config >::validate_server_handshake_response().
BOOST_AUTO_TEST_CASE | ( | client_handshake_response | ) |
Definition at line 593 of file hybi13.cpp.
References processor_setup::p, processor_setup::req, processor_setup::res, and websocketpp::processor::hybi00< config >::validate_server_handshake_response().
BOOST_AUTO_TEST_CASE | ( | extensions_disabled | ) |
Definition at line 604 of file hybi13.cpp.
References websocketpp::processor::error::extensions_disabled, websocketpp::processor::processor< config >::negotiate_extensions(), processor_setup::p, and processor_setup::req.
BOOST_AUTO_TEST_CASE | ( | extension_negotiation_blank | ) |
Definition at line 616 of file hybi13.cpp.
References websocketpp::processor::hybi13< config >::negotiate_extensions(), processor_setup_ext::p, and processor_setup_ext::req.
BOOST_AUTO_TEST_CASE | ( | extension_negotiation_unknown | ) |
Definition at line 628 of file hybi13.cpp.
References websocketpp::processor::hybi13< config >::negotiate_extensions(), processor_setup_ext::p, and processor_setup_ext::req.
BOOST_AUTO_TEST_CASE | ( | extract_subprotocols_empty | ) |
Definition at line 640 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::extract_subprotocols(), processor_setup::p, and processor_setup::req.
BOOST_AUTO_TEST_CASE | ( | extract_subprotocols_one | ) |
Definition at line 648 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::extract_subprotocols(), processor_setup::p, and processor_setup::req.
BOOST_AUTO_TEST_CASE | ( | extract_subprotocols_multiple | ) |
Definition at line 659 of file hybi13.cpp.
References websocketpp::processor::hybi00< config >::extract_subprotocols(), processor_setup::p, and processor_setup::req.
BOOST_AUTO_TEST_CASE | ( | extract_subprotocols_invalid | ) |
BOOST_AUTO_TEST_CASE | ( | extension_negotiation_permessage_deflate | ) |
Definition at line 681 of file hybi13.cpp.
References websocketpp::processor::hybi13< config >::negotiate_extensions(), processor_setup_ext::p, and processor_setup_ext::req.