2017-07-20 08:01:46 -07:00
|
|
|
//
|
2017-02-06 20:07:03 -05:00
|
|
|
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
2017-07-20 08:01:46 -07:00
|
|
|
//
|
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
// Test that header file is self-contained.
|
|
|
|
|
#include <beast/websocket/rfc6455.hpp>
|
2017-04-26 18:20:59 -07:00
|
|
|
|
|
|
|
|
#include <beast/unit_test/suite.hpp>
|
|
|
|
|
|
|
|
|
|
namespace beast {
|
|
|
|
|
namespace websocket {
|
|
|
|
|
|
|
|
|
|
class rfc6455_test
|
|
|
|
|
: public beast::unit_test::suite
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
void
|
|
|
|
|
test_is_upgrade()
|
|
|
|
|
{
|
|
|
|
|
http::request_header req;
|
|
|
|
|
req.version = 10;
|
|
|
|
|
BEAST_EXPECT(! is_upgrade(req));
|
|
|
|
|
req.version = 11;
|
|
|
|
|
req.method = "POST";
|
|
|
|
|
req.url = "/";
|
|
|
|
|
BEAST_EXPECT(! is_upgrade(req));
|
|
|
|
|
req.method = "GET";
|
|
|
|
|
req.fields.insert("Connection", "upgrade");
|
|
|
|
|
BEAST_EXPECT(! is_upgrade(req));
|
|
|
|
|
req.fields.insert("Upgrade", "websocket");
|
|
|
|
|
BEAST_EXPECT(! is_upgrade(req));
|
|
|
|
|
req.fields.insert("Sec-WebSocket-Version", "13");
|
|
|
|
|
BEAST_EXPECT(is_upgrade(req));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
run() override
|
|
|
|
|
{
|
|
|
|
|
test_is_upgrade();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BEAST_DEFINE_TESTSUITE(rfc6455,websocket,beast);
|
|
|
|
|
|
|
|
|
|
} // websocket
|
|
|
|
|
} // beast
|