57 std::string raw =
"GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n";
59 std::string firefox =
"GET / HTTP/1.1\r\nHost: localhost:5000\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0) Gecko/20100101 Firefox/10.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nAccept-Encoding: gzip, deflate\r\nConnection: keep-alive, Upgrade\r\nSec-WebSocket-Version: 8\r\nSec-WebSocket-Origin: http://zaphoyd.com\r\nSec-WebSocket-Key: pFik//FxwFk0riN4ZiPFjQ==\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nUpgrade: websocket\r\n\r\n";
61 std::string firefox1 =
"GET / HTTP/1.1\r\nHost: localhost:5000\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0) Gecko/20100101 Firefox/10.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\n";
63 std::string firefox2 =
"Accept-Encoding: gzip, deflate\r\nConnection: keep-alive, Upgrade\r\nSec-WebSocket-Version: 8\r\nSec-WebSocket-Origin: http://zaphoyd.com\r\nSec-WebSocket-Key: pFik//FxwFk0riN4ZiPFjQ==\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nUpgrade: websocket\r\n\r\n";
67 for (
int i = 0; i < 1000; i++) {
71 r.consume(raw.c_str(),raw.size());
73 std::cout <<
"exception" << std::endl;
77 std::cout <<
"error" << std::endl;
85 for (
int i = 0; i < 1000; i++) {
89 r.consume2(firefox.c_str(),firefox.size());
91 std::cout <<
"exception" << std::endl;
95 std::cout <<
"error" << std::endl;
103 for (
int i = 0; i < 1000; i++) {
107 r.consume(firefox.c_str(),firefox.size());
109 std::cout <<
"exception" << std::endl;
113 std::cout <<
"error" << std::endl;
123 for (
int i = 0; i < 1000; i++) {
127 r.consume(firefox1.c_str(),firefox1.size());
128 r.consume(firefox2.c_str(),firefox2.size());
130 std::cout <<
"exception" << std::endl;
134 std::cout <<
"error" << std::endl;