Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:34

0001 //
0002 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // Official repository: https://github.com/boostorg/beast
0008 //
0009 
0010 #ifndef BOOST_BEAST_WEBSOCKET_IMPL_RFC6455_HPP
0011 #define BOOST_BEAST_WEBSOCKET_IMPL_RFC6455_HPP
0012 
0013 #include <boost/beast/http/fields.hpp>
0014 #include <boost/beast/http/rfc7230.hpp>
0015 
0016 namespace boost {
0017 namespace beast {
0018 namespace websocket {
0019 
0020 template<class Allocator>
0021 bool
0022 is_upgrade(http::header<true,
0023     http::basic_fields<Allocator>> const& req)
0024 {
0025     if(req.version() < 11)
0026         return false;
0027     if(req.method() != http::verb::get)
0028         return false;
0029     if(! http::token_list{req[http::field::connection]}.exists("upgrade"))
0030         return false;
0031     if(! http::token_list{req[http::field::upgrade]}.exists("websocket"))
0032         return false;
0033     return true;
0034 }
0035 
0036 } // websocket
0037 } // beast
0038 } // boost
0039 
0040 #endif