httpxx 0.1
Streaming HTTP Parser for C++
|
Extra information about the request or response. More...
#include <Flags.hpp>
Public Types | |
typedef ::flags | Value |
Public Member Functions | |
bool | operator& (const Flags &rhs) const |
Check for signaled flags. | |
Static Public Member Functions | |
static const Flags | of (const ::http_parser &parser) |
Extract the flags set in parser. | |
static const Flags | chunked () |
Check if the message body is in chuncked format. | |
static const Flags | keepalive () |
Check if the client requested keep-alive. | |
static const Flags | close () |
Check if a new connection should be established for the next request. | |
static const Flags | trailing () |
static const Flags | upgrade () |
Check if the client requested a protocol upgrade. | |
static const Flags | skipbody () |
Extra information about the request or response.
Flags mainly help with connection/socket management. In particular, you can determine whether to keep the connection open for keep alive or if you should use switch to an alternate protocol handler (WebSockets, for instance).
const Flags http::Flags::close | ( | ) | [static] |
Check if a new connection should be established for the next request.
const Flags http::Flags::keepalive | ( | ) | [static] |
Check if the client requested keep-alive.
bool http::Flags::operator& | ( | const Flags & | rhs | ) | const |
const Flags http::Flags::upgrade | ( | ) | [static] |
Check if the client requested a protocol upgrade.
Newer HTTP versions support derived protocol (such as WebSockets) to re-use port 80 for additional connections. When an upgrade is requested, the parser stops accepting data as soon as the headers end. Whatever data is received next should be interpreted by a specialized protocol handler.
In particular, check the "Upgrade" header to determine what protocol was requested.