Boost C++ Libraries

PrevUpHomeNext

Struct template version_t

boost::taar::matcher::version_t — A placeholder that produces matchers comparing against a request's HTTP version.

Synopsis

// In header: <boost/taar/matcher/version.hpp>

template<typename FieldsType = boost::beast::http::fields> 
struct version_t {
  // types
  typedef boost::beast::http::request_header< FieldsType > request_type;  // The request type these matchers accept. 
};

Description

HTTP versions are encoded as a single unsigned integer in Beast: HTTP/1.0 is 10, HTTP/1.1 is 11, HTTP/2.0 is 20. Use the relational and equality operators to build a matcher:

using boost::taar::matcher::version;

auto only_11      = version == 11;
auto at_least_11  = version >= 11;
auto pre_2        = version <  20;

Each relational operator produces a single-leaf operand carrying one of the version_eq_constraint / version_ne_constraint / version_lt_constraint / version_le_constraint / version_gt_constraint / version_ge_constraint tags with the compared version in its captures tuple.

Template Parameters

  1. typename FieldsType = boost::beast::http::fields

    The Beast HTTP fields container of the request to inspect. Defaults to boost::beast::http::fields.


PrevUpHomeNext