![]() |
Ark Server API (ASE) - Wiki
|
#include <HTTPRequest.h>
Inheritance diagram for Poco::Net::HTTPRequest:
Collaboration diagram for Poco::Net::HTTPRequest:Public Member Functions | |
| HTTPRequest () | |
| HTTPRequest (const std::string &version) | |
| Creates a GET / HTTP/1.0 HTTP request. | |
| HTTPRequest (const std::string &method, const std::string &uri) | |
| HTTPRequest (const std::string &method, const std::string &uri, const std::string &version) | |
| Creates a HTTP/1.0 request with the given method and URI. | |
| HTTPRequest (const HTTPRequest &other) | |
| Creates a HTTP request with the given method, URI and version. | |
| virtual | ~HTTPRequest () |
| Creates a HTTP request by copying another one. | |
| HTTPRequest & | operator= (const HTTPRequest &) |
| Destroys the HTTPRequest. | |
| void | setMethod (const std::string &method) |
| Assignment operator. | |
| const std::string & | getMethod () const |
| Sets the method. | |
| void | setURI (const std::string &uri) |
| Returns the method. | |
| const std::string & | getURI () const |
| Sets the request URI. | |
| void | setHost (const std::string &host) |
| Returns the request URI. | |
| void | setHost (const std::string &host, Poco::UInt16 port) |
| Sets the value of the Host header field. | |
| const std::string & | getHost () const |
| void | setCookies (const NameValueCollection &cookies) |
| void | getCookies (NameValueCollection &cookies) const |
| bool | hasCredentials () const |
| void | getCredentials (std::string &scheme, std::string &authInfo) const |
| void | setCredentials (const std::string &scheme, const std::string &authInfo) |
| void | removeCredentials () |
| bool | getExpectContinue () const |
| Removes any credentials from the request. | |
| void | setExpectContinue (bool expectContinue) |
| bool | hasProxyCredentials () const |
| void | getProxyCredentials (std::string &scheme, std::string &authInfo) const |
| void | setProxyCredentials (const std::string &scheme, const std::string &authInfo) |
| void | removeProxyCredentials () |
| void | write (std::ostream &ostr) const |
| Removes any proxy credentials from the request. | |
| void | read (std::istream &istr) |
Public Member Functions inherited from Poco::Net::NameValueCollection | |
| NameValueCollection () | |
| NameValueCollection (const NameValueCollection &nvc) | |
| Creates an empty NameValueCollection. | |
| NameValueCollection (NameValueCollection &&nvc) noexcept | |
| Creates a NameValueCollection by copying another one. | |
| virtual | ~NameValueCollection () |
| Creates a NameValueCollection by moving another one. | |
| NameValueCollection & | operator= (const NameValueCollection &nvc) |
| Destroys the NameValueCollection. | |
| NameValueCollection & | operator= (NameValueCollection &&nvc) noexcept |
| Assigns the name-value pairs of another NameValueCollection to this one. | |
| void | swap (NameValueCollection &nvc) |
| Moves the name-value pairs of another NameValueCollection to this one. | |
| const std::string & | operator[] (const std::string &name) const |
| Swaps the NameValueCollection with another one. | |
| void | set (const std::string &name, const std::string &value) |
| void | add (const std::string &name, const std::string &value) |
| Sets the value of the (first) name-value pair with the given name. | |
| const std::string & | get (const std::string &name) const |
| Adds a new name-value pair with the given name and value. | |
| const std::string & | get (const std::string &name, const std::string &defaultValue) const |
| bool | has (const std::string &name) const |
| ConstIterator | find (const std::string &name) const |
| ConstIterator | begin () const |
| ConstIterator | end () const |
| bool | empty () const |
| std::size_t | size () const |
| Returns true iff the header does not have any content. | |
| void | erase (const std::string &name) |
| void | clear () |
| Removes all name-value pairs with the given name. | |
Static Public Attributes | |
| static const std::string | HTTP_GET |
| static const std::string | HTTP_HEAD |
| static const std::string | HTTP_PUT |
| static const std::string | HTTP_POST |
| static const std::string | HTTP_OPTIONS |
| static const std::string | HTTP_DELETE |
| static const std::string | HTTP_TRACE |
| static const std::string | HTTP_CONNECT |
| static const std::string | HTTP_PATCH |
| static const std::string | HOST |
| static const std::string | COOKIE |
| static const std::string | AUTHORIZATION |
| static const std::string | PROXY_AUTHORIZATION |
| static const std::string | UPGRADE |
| static const std::string | EXPECT |
Protected Member Functions | |
| void | getCredentials (const std::string &header, std::string &scheme, std::string &authInfo) const |
| void | setCredentials (const std::string &header, const std::string &scheme, const std::string &authInfo) |
Private Types | |
| enum | Limits { MAX_METHOD_LENGTH = 32 , MAX_URI_LENGTH = 16384 , MAX_VERSION_LENGTH = 8 } |
Private Attributes | |
| std::string | _method |
| std::string | _uri |
Additional Inherited Members | |
Public Types inherited from Poco::Net::NameValueCollection | |
| using | HeaderMap = Poco::ListMap<std::string, std::string> |
| using | Iterator = HeaderMap::Iterator |
| using | ConstIterator = HeaderMap::ConstIterator |
This class encapsulates an HTTP request message.
In addition to the properties common to all HTTP messages, a HTTP request has a method (e.g. GET, HEAD, POST, etc.) and a request URI.
Definition at line 29 of file HTTPRequest.h.
|
private |
Writes the authentication scheme and information for this request to the given header.
| Enumerator | |
|---|---|
| MAX_METHOD_LENGTH | |
| MAX_URI_LENGTH | |
| MAX_VERSION_LENGTH | |
Definition at line 179 of file HTTPRequest.h.
| Poco::Net::HTTPRequest::HTTPRequest | ( | ) |
|
explicit |
Creates a GET / HTTP/1.0 HTTP request.
| Poco::Net::HTTPRequest::HTTPRequest | ( | const std::string & | method, |
| const std::string & | uri ) |
Creates a GET / HTTP/1.x request with the given version (HTTP/1.0 or HTTP/1.1).
| Poco::Net::HTTPRequest::HTTPRequest | ( | const std::string & | method, |
| const std::string & | uri, | ||
| const std::string & | version ) |
Creates a HTTP/1.0 request with the given method and URI.
Here is the caller graph for this function:| Poco::Net::HTTPRequest::HTTPRequest | ( | const HTTPRequest & | other | ) |
Creates a HTTP request with the given method, URI and version.
|
virtual |
Creates a HTTP request by copying another one.
| void Poco::Net::HTTPRequest::getCookies | ( | NameValueCollection & | cookies | ) | const |
Adds a Cookie header with the names and values from cookies.
|
protected |
| void Poco::Net::HTTPRequest::getCredentials | ( | std::string & | scheme, |
| std::string & | authInfo ) const |
Returns true iff the request contains authentication information in the form of an Authorization header.
| bool Poco::Net::HTTPRequest::getExpectContinue | ( | ) | const |
Removes any credentials from the request.
| const std::string & Poco::Net::HTTPRequest::getHost | ( | ) | const |
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.
|
inline |
Sets the method.
Definition at line 194 of file HTTPRequest.h.
| void Poco::Net::HTTPRequest::getProxyCredentials | ( | std::string & | scheme, |
| std::string & | authInfo ) const |
Returns true iff the request contains proxy authentication information in the form of an Proxy-Authorization header.
|
inline |
Sets the request URI.
Definition at line 200 of file HTTPRequest.h.
| bool Poco::Net::HTTPRequest::hasCredentials | ( | ) | const |
Fills cookies with the cookies extracted from the Cookie headers in the request.
| bool Poco::Net::HTTPRequest::hasProxyCredentials | ( | ) | const |
Adds a "Expect: 100-continue" header to the request if expectContinue is true, otherwise removes the Expect header.
| HTTPRequest & Poco::Net::HTTPRequest::operator= | ( | const HTTPRequest & | ) |
Destroys the HTTPRequest.
|
virtual |
Writes the HTTP request to the given output stream.
Reimplemented from Poco::Net::MessageHeader.
| void Poco::Net::HTTPRequest::removeCredentials | ( | ) |
Sets the authentication scheme and information for this request.
| void Poco::Net::HTTPRequest::removeProxyCredentials | ( | ) |
Sets the proxy authentication scheme and information for this request.
| void Poco::Net::HTTPRequest::setCookies | ( | const NameValueCollection & | cookies | ) |
Returns the value of the Host header field.
Throws a NotFoundException if the request does not have a Host header field.
|
protected |
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.
| void Poco::Net::HTTPRequest::setCredentials | ( | const std::string & | scheme, |
| const std::string & | authInfo ) |
Returns the authentication scheme and additional authentication information contained in this request.
Throws a NotAuthenticatedException if no authentication information is contained in the request.
| void Poco::Net::HTTPRequest::setExpectContinue | ( | bool | expectContinue | ) |
Returns true if the request contains an "Expect: 100-continue" header.
| void Poco::Net::HTTPRequest::setHost | ( | const std::string & | host | ) |
Returns the request URI.
| void Poco::Net::HTTPRequest::setHost | ( | const std::string & | host, |
| Poco::UInt16 | port ) |
Sets the value of the Host header field.
| void Poco::Net::HTTPRequest::setMethod | ( | const std::string & | method | ) |
Assignment operator.
| void Poco::Net::HTTPRequest::setProxyCredentials | ( | const std::string & | scheme, |
| const std::string & | authInfo ) |
Returns the proxy authentication scheme and additional proxy authentication information contained in this request.
Throws a NotAuthenticatedException if no proxy authentication information is contained in the request.
| void Poco::Net::HTTPRequest::setURI | ( | const std::string & | uri | ) |
Returns the method.
|
virtual |
Removes any proxy credentials from the request.
Reimplemented from Poco::Net::MessageHeader.
|
private |
Definition at line 186 of file HTTPRequest.h.
|
private |
Definition at line 187 of file HTTPRequest.h.
|
static |
Definition at line 161 of file HTTPRequest.h.
|
static |
Definition at line 160 of file HTTPRequest.h.
|
static |
Definition at line 164 of file HTTPRequest.h.
|
static |
Definition at line 159 of file HTTPRequest.h.
|
static |
Definition at line 156 of file HTTPRequest.h.
|
static |
Definition at line 154 of file HTTPRequest.h.
|
static |
Reads the HTTP request from the given input stream.
Definition at line 149 of file HTTPRequest.h.
|
static |
Definition at line 150 of file HTTPRequest.h.
|
static |
Definition at line 153 of file HTTPRequest.h.
|
static |
Definition at line 157 of file HTTPRequest.h.
|
static |
Definition at line 152 of file HTTPRequest.h.
|
static |
Definition at line 151 of file HTTPRequest.h.
|
static |
Definition at line 155 of file HTTPRequest.h.
|
static |
Definition at line 162 of file HTTPRequest.h.
|
static |
Definition at line 163 of file HTTPRequest.h.