Request
Request
#include <icy/http/request.h>class RequestDefined in src/http/include/icy/http/request.h:44
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.
List of all members
| Name | Kind | Owner |
|---|---|---|
operator<< | friend | Declared here |
Request | function | Declared here |
Request | function | Declared here |
Request | function | Declared here |
Request | function | Declared here |
~Request | function | Declared here |
setMethod | function | Declared here |
getMethod | function | Declared here |
setURI | function | Declared here |
appendURI | function | Declared here |
getURI | function | Declared here |
setHost | function | Declared here |
setHost | function | Declared here |
getHost | function | Declared here |
setCookies | function | Declared here |
getCookies | function | Declared here |
getURIParameters | function | Declared here |
hasCredentials | function | Declared here |
getCredentials | function | Declared here |
setCredentials | function | Declared here |
hasProxyCredentials | function | Declared here |
getProxyCredentials | function | Declared here |
setProxyCredentials | function | Declared here |
write | function | Declared here |
write | function | Declared here |
write | function | Declared here |
getCredentials | function | Declared here |
setCredentials | function | Declared here |
_method | variable | Declared here |
_uri | variable | Declared here |
setVersion | function | Inherited from Message |
getVersion | function | Inherited from Message |
setContentLength | function | Inherited from Message |
getContentLength | function | Inherited from Message |
hasContentLength | function | Inherited from Message |
setTransferEncoding | function | Inherited from Message |
getTransferEncoding | function | Inherited from Message |
setChunkedTransferEncoding | function | Inherited from Message |
isChunkedTransferEncoding | function | Inherited from Message |
setContentType | function | Inherited from Message |
getContentType | function | Inherited from Message |
setKeepAlive | function | Inherited from Message |
getKeepAlive | function | Inherited from Message |
write | function | Inherited from Message |
write | function | Inherited from Message |
write | function | Inherited from Message |
HTTP_1_0 | variable | Inherited from Message |
HTTP_1_1 | variable | Inherited from Message |
IDENTITY_TRANSFER_ENCODING | variable | Inherited from Message |
CHUNKED_TRANSFER_ENCODING | variable | Inherited from Message |
UNKNOWN_CONTENT_LENGTH | variable | Inherited from Message |
UNKNOWN_CONTENT_TYPE | variable | Inherited from Message |
CONTENT_LENGTH | variable | Inherited from Message |
CONTENT_TYPE | variable | Inherited from Message |
TRANSFER_ENCODING | variable | Inherited from Message |
CONNECTION | variable | Inherited from Message |
CONNECTION_KEEP_ALIVE | variable | Inherited from Message |
CONNECTION_CLOSE | variable | Inherited from Message |
EMPTY | variable | Inherited from Message |
_version | variable | Inherited from Message |
Message | function | Inherited from Message |
Message | function | Inherited from Message |
~Message | function | Inherited from Message |
NVCollection | function | Inherited from NVCollection |
NVCollection | function | Inherited from NVCollection |
NVCollection | function | Inherited from NVCollection |
~NVCollection | function | Inherited from NVCollection |
operator= | function | Inherited from NVCollection |
operator= | function | Inherited from NVCollection |
operator[] | function | Inherited from NVCollection |
set | function | Inherited from NVCollection |
add | function | Inherited from NVCollection |
add | function | Inherited from NVCollection |
get | function | Inherited from NVCollection |
get | function | Inherited from NVCollection |
has | function | Inherited from NVCollection |
find | function | Inherited from NVCollection |
begin | function | Inherited from NVCollection |
end | function | Inherited from NVCollection |
empty | function | Inherited from NVCollection |
size | function | Inherited from NVCollection |
erase | function | Inherited from NVCollection |
clear | function | Inherited from NVCollection |
Map | typedef | Inherited from NVCollection |
Iterator | typedef | Inherited from NVCollection |
ConstIterator | typedef | Inherited from NVCollection |
_map | variable | Inherited from NVCollection |
Inherited from Message
| Kind | Name | Description |
|---|---|---|
function | setVersion | Sets the HTTP version for this message. |
function | getVersion const | Returns the HTTP version for this message. |
function | setContentLength | Sets the Content-Length header. |
function | getContentLength const | Returns the content length for this message, which may be UNKNOWN_CONTENT_LENGTH if no Content-Length header is present. |
function | hasContentLength const | Returns true if a Content-Length header is present. |
function | setTransferEncoding | Sets the transfer encoding for this message. |
function | getTransferEncoding const | Returns the transfer encoding used for this message. |
function | setChunkedTransferEncoding | If flag is true, sets the Transfer-Encoding header to chunked. Otherwise, removes the Transfer-Encoding header. |
function | isChunkedTransferEncoding const | Returns true if the Transfer-Encoding header is set and its value is chunked. |
function | setContentType | Sets the content type for this message. |
function | getContentType const | Returns the content type for this message. |
function | setKeepAlive | Sets the value of the Connection header field. |
function | getKeepAlive const | Returns true if |
function | write virtual const | Writes the message header to the given output stream. |
function | write virtual const | Writes the message header to the given output string. |
function | write virtual const | Writes the message header directly into a byte buffer. |
variable | HTTP_1_0 static | |
variable | HTTP_1_1 static | |
variable | IDENTITY_TRANSFER_ENCODING static | |
variable | CHUNKED_TRANSFER_ENCODING static | |
variable | UNKNOWN_CONTENT_LENGTH static | |
variable | UNKNOWN_CONTENT_TYPE static | |
variable | CONTENT_LENGTH static | |
variable | CONTENT_TYPE static | |
variable | TRANSFER_ENCODING static | |
variable | CONNECTION static | |
variable | CONNECTION_KEEP_ALIVE static | |
variable | CONNECTION_CLOSE static | |
variable | EMPTY static | |
variable | _version | |
function | Message | Creates the Message with version HTTP/1.0. |
function | Message | Creates the Message and sets the version. |
function | ~Message virtual | Destroys the Message. |
Inherited from NVCollection
| Kind | Name | Description |
|---|---|---|
function | NVCollection inline | |
function | NVCollection inline | |
function | NVCollection inline noexcept | |
function | ~NVCollection virtual inline | |
function | operator= | Assigns the name-value pairs of another NVCollection to this one. |
function | operator= noexcept | |
function | operator[] const | Returns the value of the (first) name-value pair with the given name. |
function | set | Sets the value of the (first) name-value pair with the given name. |
function | add | Adds a new name-value pair with the given name and value. |
function | add | Adds a new name-value pair using move semantics. |
function | get const | Returns the value of the first name-value pair with the given name. |
function | get const | Returns the value of the first name-value pair with the given name. If no value with the given name has been found, the defaultValue is returned. |
function | has const | Returns true if there is at least one name-value pair with the given name. |
function | find const | Returns an iterator pointing to the first name-value pair with the given name. |
function | begin const | Returns an iterator pointing to the begin of the name-value pair collection. |
function | end const | Returns an iterator pointing to the end of the name-value pair collection. |
function | empty const | Returns true iff the header does not have any content. |
function | size const | Returns the number of name-value pairs in the collection. |
function | erase | Removes all name-value pairs with the given name. |
function | clear | Removes all name-value pairs and their values. |
typedef | Map | |
typedef | Iterator | |
typedef | ConstIterator | |
variable | _map |
Friends
| Name | Description |
|---|---|
operator<< inline |
operator<<
inline
friend inline std::ostream & operator<<(std::ostream & stream, const Request & req)Defined in src/http/include/icy/http/request.h:146
Public Methods
| 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
Request()Defined in src/http/include/icy/http/request.h:48
Creates a GET / HTTP/1.1 HTTP request.
Request
Request(const std::string & version)Defined in src/http/include/icy/http/request.h:52
Creates a GET / HTTP/1.x request with the given version (HTTP/1.0 or HTTP/1.1).
Request
Request(const std::string & method, const std::string & uri)Defined in src/http/include/icy/http/request.h:55
Creates an HTTP/1.0 request with the given method and URI.
Request
Request(const std::string & method, const std::string & uri, const std::string & version)Defined in src/http/include/icy/http/request.h:58
Creates an HTTP request with the given method, URI and version.
~Request
virtual
virtual ~Request()Defined in src/http/include/icy/http/request.h:61
Destroys the Request.
setMethod
void setMethod(const std::string & method)Defined in src/http/include/icy/http/request.h:64
Sets the method.
getMethod
const
const std::string & getMethod() constDefined in src/http/include/icy/http/request.h:67
Returns the method.
setURI
void setURI(std::string uri)Defined in src/http/include/icy/http/request.h:70
Sets the request URI.
appendURI
void appendURI(std::string_view uri)Defined in src/http/include/icy/http/request.h:74
Appends a fragment to the request URI. Used by the parser when llhttp splits the URL across callbacks.
getURI
const
const std::string & getURI() constDefined in src/http/include/icy/http/request.h:77
Returns the request URI.
setHost
void setHost(const std::string & host)Defined in src/http/include/icy/http/request.h:80
Sets the value of the Host header field.
setHost
void setHost(const std::string & host, uint16_t port)Defined in src/http/include/icy/http/request.h:87
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.
getHost
const
const std::string & getHost() constDefined in src/http/include/icy/http/request.h:93
Returns the value of the Host header field.
Throws a NotFoundException if the request does not have a Host header field.
setCookies
void setCookies(const NVCollection & cookies)Defined in src/http/include/icy/http/request.h:97
Adds a Cookie header with the names and values from cookies.
getCookies
const
void getCookies(NVCollection & cookies) constDefined in src/http/include/icy/http/request.h:101
Fills cookies with the cookies extracted from the Cookie headers in the request.
getURIParameters
const
void getURIParameters(NVCollection & params) constDefined in src/http/include/icy/http/request.h:104
Returns the request URI parameters.
hasCredentials
const
bool hasCredentials() constDefined in src/http/include/icy/http/request.h:108
Returns true if the request contains authentication information in the form of an Authorization header.
getCredentials
const
void getCredentials(std::string & scheme, std::string & authInfo) constDefined in src/http/include/icy/http/request.h:115
Returns the authentication scheme and additional authentication information contained in this request.
Throws a std::exception if no authentication information is contained in the request.
setCredentials
void setCredentials(std::string_view scheme, std::string_view authInfo)Defined in src/http/include/icy/http/request.h:119
Sets the authentication scheme and information for this request.
hasProxyCredentials
const
bool hasProxyCredentials() constDefined in src/http/include/icy/http/request.h:123
Returns true if the request contains proxy authentication information in the form of an Proxy-Authorization header.
getProxyCredentials
const
void getProxyCredentials(std::string & scheme, std::string & authInfo) constDefined in src/http/include/icy/http/request.h:131
Returns 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.
setProxyCredentials
void setProxyCredentials(std::string_view scheme, std::string_view authInfo)Defined in src/http/include/icy/http/request.h:134
Sets the proxy authentication scheme and information for this request.
write
virtual const
virtual void write(std::ostream & ostr) constDefined in src/http/include/icy/http/request.h:138
Writes the HTTP request to the given output stream.
Reimplements
write
virtual const
virtual void write(std::string & str) constDefined in src/http/include/icy/http/request.h:141
Writes the HTTP request to the given output string.
Reimplements
write
virtual const
virtual void write(Buffer & buf) constDefined in src/http/include/icy/http/request.h:144
Writes the HTTP request directly into a byte buffer.
Reimplements
Protected Methods
| 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. |
getCredentials
const
void getCredentials(const std::string & header, std::string & scheme, std::string & authInfo) constDefined in src/http/include/icy/http/request.h:158
Returns 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.
setCredentials
void setCredentials(const std::string & header, std::string_view scheme, std::string_view authInfo)Defined in src/http/include/icy/http/request.h:162
Writes the authentication scheme and information for this request to the given header.
Private Attributes
_method
std::string _methodDefined in src/http/include/icy/http/request.h:165
_uri
std::string _uri