ark::comms::HttpRequest

Defined in header “ark/comms/http_request.hh”.


A basic structure representing an HTTP request. These can be parsed from the HttpRequestParser, or converted into a valid request by using str() on it.

Methods

  • int64_t expected_payload_size()
    Convenience method returns the number of bytes that are expected in the payload (if any).

  • bool has_field_value(const std::string & key, const std::string & value)
    Returns true if this request both has the given field, and the value matches that field’s value.

  • const std::string & query_value(const std::string & key, const std::string & default_value)
    Returns the value of the given query pair, or the default if the value is not specified.

  • std::string str()
    Returns a string form of the HTTP request, suitable for sending over the wire.

  • comms::NetworkAddress client_network_address()
    Returns the client network address (as best can be determined). Will be the originating network address typically, but if X-Forwarded-For is present, will use that.

  • bool operator==(const HttpRequest & other)
    Generate a default equality.

Variables

  • HttpRequestType type= HttpRequestType::GET
    The type of HTTP request.

  • std::string path
    The path that is being requested.

  • std::map< std::string, std::string, core::CaseInsensitiveComparator > fields
    Header fields (key/value pairs).

  • std::map< std::string, std::string > query_pairs
    If the path has a query string, this will contain the decomposed key/value pairs.

  • comms::NetworkAddress originating_network_address
    The network address that originated this request.

  • core::ByteBuffer header
    The raw header bytes.

  • core::ByteBuffer payload
    The payload (may or may not be present).