2017-07-20 08:01:46 -07:00
|
|
|
//
|
2019-02-21 07:00:31 -08:00
|
|
|
// Copyright (c) 2016-2019 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)
|
|
|
|
|
//
|
2017-07-20 13:40:34 -07:00
|
|
|
// Official repository: https://github.com/boostorg/beast
|
|
|
|
|
//
|
2017-07-20 08:01:46 -07:00
|
|
|
|
|
|
|
|
// Test that header file is self-contained.
|
2017-07-20 13:40:34 -07:00
|
|
|
#include <boost/beast/websocket/rfc6455.hpp>
|
2017-04-26 18:20:59 -07:00
|
|
|
|
2018-11-11 14:07:55 -08:00
|
|
|
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
2017-04-26 18:20:59 -07:00
|
|
|
|
2017-07-20 13:40:34 -07:00
|
|
|
namespace boost {
|
2017-04-26 18:20:59 -07:00
|
|
|
namespace beast {
|
|
|
|
|
namespace websocket {
|
|
|
|
|
|
|
|
|
|
class rfc6455_test
|
|
|
|
|
: public beast::unit_test::suite
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
void
|
|
|
|
|
test_is_upgrade()
|
|
|
|
|
{
|
2017-05-27 22:49:22 -07:00
|
|
|
http::header<true> req;
|
2017-09-12 13:49:45 -07:00
|
|
|
req.version(10);
|
2017-07-25 12:35:54 -07:00
|
|
|
BEAST_EXPECT(! is_upgrade(req));
|
2017-09-12 13:49:45 -07:00
|
|
|
req.version(11);
|
2017-05-30 06:58:40 -07:00
|
|
|
req.method(http::verb::post);
|
2017-05-02 15:49:22 -07:00
|
|
|
req.target("/");
|
2017-07-25 12:35:54 -07:00
|
|
|
BEAST_EXPECT(! is_upgrade(req));
|
2017-05-30 06:58:40 -07:00
|
|
|
req.method(http::verb::get);
|
2017-06-05 19:28:17 -07:00
|
|
|
req.insert("Connection", "upgrade");
|
2017-07-25 12:35:54 -07:00
|
|
|
BEAST_EXPECT(! is_upgrade(req));
|
2017-06-05 19:28:17 -07:00
|
|
|
req.insert("Upgrade", "websocket");
|
2017-07-25 12:35:54 -07:00
|
|
|
BEAST_EXPECT(is_upgrade(req));
|
2017-04-26 18:20:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
run() override
|
|
|
|
|
{
|
|
|
|
|
test_is_upgrade();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2017-08-01 17:01:57 -07:00
|
|
|
BEAST_DEFINE_TESTSUITE(beast,websocket,rfc6455);
|
2017-04-26 18:20:59 -07:00
|
|
|
|
|
|
|
|
} // websocket
|
|
|
|
|
} // beast
|
2017-07-20 13:40:34 -07:00
|
|
|
} // boost
|