RESTinio
|
Tools for working with media-type in HTTP-fields. More...
#include <media-type.hpp>
Public Types | |
using | parameter_t = parameter_with_mandatory_value_t |
using | parameter_container_t = parameter_with_mandatory_value_container_t |
Static Public Member Functions | |
static RESTINIO_NODISCARD auto | make_default_parser () |
static RESTINIO_NODISCARD auto | make_weight_aware_parser () |
static RESTINIO_NODISCARD expected_t< media_type_value_t, restinio::easy_parser::parse_error_t > | try_parse (string_view_t what) |
An attempt to parse media-type value. More... | |
Public Attributes | |
std::string | type |
std::string | subtype |
parameter_container_t | parameters |
Tools for working with media-type in HTTP-fields.
This struct represents parsed value of media-type. Media-type is present in different HTTP-fields and has the following format (see https://tools.ietf.org/html/rfc7231 section 3.1.1.1. Media Type
):
media-type = type "/" subtype *( OWS ";" OWS parameter ) type = token subtype = token parameter = token "=" ( token / quoted-string )
Definition at line 41 of file media-type.hpp.
using restinio::http_field_parsers::media_type_value_t::parameter_container_t = parameter_with_mandatory_value_container_t |
Definition at line 45 of file media-type.hpp.
using restinio::http_field_parsers::media_type_value_t::parameter_t = parameter_with_mandatory_value_t |
Definition at line 43 of file media-type.hpp.
|
inlinestatic |
@brief Make a default parser that doesn't handles weight parameter a special way. This parser handles the following rules:
media-type = type "/" subtype *( OWS ";" OWS parameter ) type = token subtype = token parameter = token "=" ( token / quoted-string )
Definition at line 66 of file media-type.hpp.
|
inlinestatic |
@brief Make a special parser that stops when weight parameter is found. This parser handles the following rules:
media-type = type "/" subtype *( ![weight] OWS ";" OWS parameter ) type = token subtype = token parameter = token "=" ( token / quoted-string ) weight = OWS ";" OWS "q=" qvalue qvalue = ( "0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] )
Definition at line 93 of file media-type.hpp.
|
inlinestatic |
An attempt to parse media-type value.
Definition at line 128 of file media-type.hpp.
parameter_container_t restinio::http_field_parsers::media_type_value_t::parameters |
Definition at line 49 of file media-type.hpp.
std::string restinio::http_field_parsers::media_type_value_t::subtype |
Definition at line 48 of file media-type.hpp.
std::string restinio::http_field_parsers::media_type_value_t::type |
Definition at line 47 of file media-type.hpp.