1//
2// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3//
4// Distributed under the Boost Software License, Version 1.0. (See accompanying
5// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7// Official repository: https://github.com/boostorg/beast
8//
9
10#ifndef BOOST_BEAST_WEBSOCKET_IMPL_RFC6455_HPP
11#define BOOST_BEAST_WEBSOCKET_IMPL_RFC6455_HPP
12
13#include <boost/beast/http/fields.hpp>
14#include <boost/beast/http/rfc7230.hpp>
15
16namespace boost {
17namespace beast {
18namespace websocket {
19
20template<class Allocator>
21bool
22is_upgrade(http::header<true,
23 http::basic_fields<Allocator>> const& req)
24{
25 if(req.version() < 11)
26 return false;
27 if(req.method() != http::verb::get)
28 return false;
29 if(! http::token_list{req[http::field::connection]}.exists(s: "upgrade"))
30 return false;
31 if(! http::token_list{req[http::field::upgrade]}.exists(s: "websocket"))
32 return false;
33 return true;
34}
35
36} // websocket
37} // beast
38} // boost
39
40#endif
41

source code of boost/libs/beast/include/boost/beast/websocket/impl/rfc6455.hpp