#include <icy/http/request.h>Inherits:
Message
HTTP request message with method, URI, headers, and optional body.
In addition to the properties common to all HTTP messages, an HTTP request has a method (e.g. GET, HEAD, POST, etc.) and a request URI.
| Return | Name | Description |
|---|---|---|
Request | Creates a GET / HTTP/1.1 HTTP request. | |
Request | Creates a GET / HTTP/1.x request with the given version (HTTP/1.0 or HTTP/1.1). | |
Request | Creates an HTTP/1.0 request with the given method and URI. | |
Request | Creates an HTTP request with the given method, URI and version. | |
~Request virtual | Destroys the Request. | |
void | setMethod | Sets the method. |
const std::string & | getMethod const | Returns the method. |
void | setURI | Sets the request URI. |
void | appendURI | Appends a fragment to the request URI. Used by the parser when llhttp splits the URL across callbacks. |
const std::string & | getURI const | Returns the request URI. |
void | setHost | Sets the value of the Host header field. |
void | setHost | Sets the value of the Host header field. |
const std::string & | getHost const | Returns the value of the Host header field. |
void | setCookies | Adds a Cookie header with the names and values from cookies. |
void | getCookies const | Fills cookies with the cookies extracted from the Cookie headers in the request. |
void | getURIParameters const | Returns the request URI parameters. |
bool | hasCredentials const | Returns true if the request contains authentication information in the form of an Authorization header. |
void | getCredentials const | Returns the authentication scheme and additional authentication information contained in this request. |
void | setCredentials | Sets the authentication scheme and information for this request. |
bool | hasProxyCredentials const | Returns true if the request contains proxy authentication information in the form of an Proxy-Authorization header. |
void | getProxyCredentials const | Returns the proxy authentication scheme and additional proxy authentication information contained in this request. |
void | setProxyCredentials | Sets the proxy authentication scheme and information for this request. |
void | write virtual const | Writes the HTTP request to the given output stream. |
void | write virtual const | Writes the HTTP request to the given output string. |
void | write virtual const | Writes the HTTP request directly into a byte buffer. |
Request()Creates a GET / HTTP/1.1 HTTP request.
Request(const std::string & version)Creates a GET / HTTP/1.x request with the given version (HTTP/1.0 or HTTP/1.1).
Request(const std::string & method, const std::string & uri)Creates an HTTP/1.0 request with the given method and URI.
Request(const std::string & method, const std::string & uri, const std::string & version)Creates an HTTP request with the given method, URI and version.
virtual
virtual ~Request()Destroys the Request.
void setMethod(const std::string & method)Sets the method.
const
const std::string & getMethod() constReturns the method.
void setURI(std::string uri)Sets the request URI.
void appendURI(std::string_view uri)Appends a fragment to the request URI. Used by the parser when llhttp splits the URL across callbacks.
const
const std::string & getURI() constReturns the request URI.
void setHost(const std::string & host)Sets the value of the Host header field.
void setHost(const std::string & host, uint16_t port)Sets the value of the Host header field.
If the given port number is a non-standard port number (other than 80 or 443), it is included in the Host header field.
const
const std::string & getHost() constReturns the value of the Host header field.
Throws a NotFoundException if the request does not have a Host header field.
void setCookies(const NVCollection & cookies)Adds a Cookie header with the names and values from cookies.
const
void getCookies(NVCollection & cookies) constFills cookies with the cookies extracted from the Cookie headers in the request.
const
void getURIParameters(NVCollection & params) constReturns the request URI parameters.
const
bool hasCredentials() constReturns true if the request contains authentication information in the form of an Authorization header.
const
void getCredentials(std::string & scheme, std::string & authInfo) constReturns the authentication scheme and additional authentication information contained in this request.
Throws a std::exception if no authentication information is contained in the request.
void setCredentials(std::string_view scheme, std::string_view authInfo)Sets the authentication scheme and information for this request.
const
bool hasProxyCredentials() constReturns true if the request contains proxy authentication information in the form of an Proxy-Authorization header.
const
void getProxyCredentials(std::string & scheme, std::string & authInfo) constReturns the proxy authentication scheme and additional proxy authentication information contained in this request.
Throws a std::exception if no proxy authentication information is contained in the request.
void setProxyCredentials(std::string_view scheme, std::string_view authInfo)Sets the proxy authentication scheme and information for this request.
virtual const
virtual void write(std::ostream & ostr) constWrites the HTTP request to the given output stream.
virtual const
virtual void write(std::string & str) constWrites the HTTP request to the given output string.
virtual const
virtual void write(Buffer & buf) constWrites the HTTP request directly into a byte buffer.
| Return | Name | Description |
|---|---|---|
void | getCredentials const | Returns the authentication scheme and additional authentication information contained in the given header of request. |
void | setCredentials | Writes the authentication scheme and information for this request to the given header. |
const
void getCredentials(const std::string & header, std::string & scheme, std::string & authInfo) constReturns the authentication scheme and additional authentication information contained in the given header of request.
Throws a NotAuthenticatedException if no authentication information is contained in the request.
void setCredentials(const std::string & header, std::string_view scheme, std::string_view authInfo)Writes the authentication scheme and information for this request to the given header.
std::string _methodstd::string _uri