Files
boost_beast/include/boost/beast/websocket/impl/rfc6455.hpp
T

41 lines
1013 B
C++
Raw Normal View History

2017-04-26 18:20:59 -07:00
//
2019-02-21 07:00:31 -08:00
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
2017-04-26 18:20:59 -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-04-26 18:20:59 -07:00
2019-01-19 07:24:00 -08:00
#ifndef BOOST_BEAST_WEBSOCKET_IMPL_RFC6455_HPP
#define BOOST_BEAST_WEBSOCKET_IMPL_RFC6455_HPP
2017-04-26 18:20:59 -07:00
2017-07-20 13:40:34 -07:00
#include <boost/beast/http/fields.hpp>
#include <boost/beast/http/rfc7230.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 {
2017-06-19 13:01:59 -07:00
template<class Allocator>
2017-04-26 18:20:59 -07:00
bool
2017-06-19 13:01:59 -07:00
is_upgrade(http::header<true,
http::basic_fields<Allocator>> const& req)
2017-04-26 18:20:59 -07:00
{
if(req.version() < 11)
2017-04-26 18:20:59 -07:00
return false;
2017-06-04 10:03:36 -07:00
if(req.method() != http::verb::get)
2017-04-26 18:20:59 -07:00
return false;
2018-01-01 17:49:19 -08:00
if(! http::token_list{req[http::field::connection]}.exists("upgrade"))
2017-04-26 18:20:59 -07:00
return false;
2018-01-01 17:49:19 -08:00
if(! http::token_list{req[http::field::upgrade]}.exists("websocket"))
2017-04-26 18:20:59 -07:00
return false;
return true;
}
} // websocket
} // beast
2017-07-20 13:40:34 -07:00
} // boost
2017-04-26 18:20:59 -07:00
#endif