Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Provides storage for an incoming HTTP request. More...
#include <HTTPMessage.h>
Classes | |
class | cUserData |
Base class for anything that can be used as the UserData for the request. More... | |
Public Types | |
using | cUserDataPtr = std::shared_ptr< cUserData > |
Public Types inherited from cHTTPMessage | |
enum | eKind { mkRequest , mkResponse } |
enum | eStatus { HTTP_OK = 200 , HTTP_BAD_REQUEST = 400 } |
Public Member Functions | |
virtual void | AddHeader (const AString &a_Key, const AString &a_Value) override |
Adds the specified header into the internal list of headers. More... | |
cHTTPIncomingRequest (const AString &a_Method, const AString &a_URL) | |
Creates a new instance of the class, containing the method and URL provided by the client. More... | |
bool | DoesAllowKeepAlive (void) const |
const AString & | GetAuthPassword (void) const |
Returns the password that the request presented. More... | |
const AString & | GetAuthUsername (void) const |
Returns the username that the request presented. More... | |
const AString & | GetMethod (void) const |
Returns the method used in the request. More... | |
const AString & | GetURL (void) const |
Returns the URL used in the request. More... | |
AString | GetURLPath (void) const |
Returns the path part of the URL. More... | |
cUserDataPtr | GetUserData (void) |
Returns the data attached to this request by the class client. More... | |
bool | HasAuth (void) const |
Returns true if the request has had the Auth header present. More... | |
void | SetUserData (cUserDataPtr a_UserData) |
Attaches any kind of data to this request, to be later retrieved by GetUserData(). More... | |
Public Member Functions inherited from cHTTPMessage | |
cHTTPMessage (eKind a_Kind) | |
size_t | GetContentLength (void) const |
const AString & | GetContentType (void) const |
void | SetContentLength (size_t a_ContentLength) |
void | SetContentType (const AString &a_ContentType) |
virtual | ~cHTTPMessage () |
Protected Attributes | |
bool | m_AllowKeepAlive |
Set to true if the request indicated that it supports keepalives. More... | |
AString | m_AuthPassword |
The password used for auth. More... | |
AString | m_AuthUsername |
The username used for auth. More... | |
bool | m_HasAuth |
Set to true if the request contains auth data that was understood by the parser. More... | |
AString | m_Method |
Method of the request (GET / PUT / POST / ...) More... | |
AString | m_URL |
Full URL of the request. More... | |
cUserDataPtr | m_UserData |
Any data attached to the request by the class client. More... | |
Protected Attributes inherited from cHTTPMessage | |
size_t | m_ContentLength |
Length of the content that is to be received. More... | |
AString | m_ContentType |
Type of the content; parsed by AddHeader(), set directly by SetContentLength() More... | |
AStringMap | m_Headers |
Map of headers, with their keys lowercased. More... | |
eKind | m_Kind |
Private Types | |
using | Super = cHTTPMessage |
Additional Inherited Members | |
Protected Types inherited from cHTTPMessage | |
using | cNameValueMap = std::map< AString, AString > |
Provides storage for an incoming HTTP request.
Definition at line 88 of file HTTPMessage.h.
using cHTTPIncomingRequest::cUserDataPtr = std::shared_ptr<cUserData> |
Definition at line 102 of file HTTPMessage.h.
|
private |
Definition at line 91 of file HTTPMessage.h.
Creates a new instance of the class, containing the method and URL provided by the client.
Definition at line 107 of file HTTPMessage.cpp.
|
overridevirtual |
Adds the specified header into the internal list of headers.
Overrides the parent to add recognizing additional headers: auth and keepalive.
Reimplemented from cHTTPMessage.
Definition at line 136 of file HTTPMessage.cpp.
|
inline |
Definition at line 126 of file HTTPMessage.h.
|
inline |
Returns the password that the request presented.
Only valid if HasAuth() is true
Definition at line 124 of file HTTPMessage.h.
|
inline |
Returns the username that the request presented.
Only valid if HasAuth() is true
Definition at line 121 of file HTTPMessage.h.
|
inline |
Returns the method used in the request.
Definition at line 109 of file HTTPMessage.h.
|
inline |
Returns the URL used in the request.
Definition at line 112 of file HTTPMessage.h.
AString cHTTPIncomingRequest::GetURLPath | ( | void | ) | const |
Returns the path part of the URL.
Definition at line 119 of file HTTPMessage.cpp.
|
inline |
Returns the data attached to this request by the class client.
Definition at line 132 of file HTTPMessage.h.
|
inline |
Returns true if the request has had the Auth header present.
Definition at line 118 of file HTTPMessage.h.
|
inline |
Attaches any kind of data to this request, to be later retrieved by GetUserData().
Definition at line 129 of file HTTPMessage.h.
|
protected |
Set to true if the request indicated that it supports keepalives.
If false, the server will close the connection once the request is finished
Definition at line 157 of file HTTPMessage.h.
|
protected |
The password used for auth.
Definition at line 153 of file HTTPMessage.h.
|
protected |
The username used for auth.
Definition at line 150 of file HTTPMessage.h.
|
protected |
Set to true if the request contains auth data that was understood by the parser.
Definition at line 147 of file HTTPMessage.h.
|
protected |
Method of the request (GET / PUT / POST / ...)
Definition at line 141 of file HTTPMessage.h.
|
protected |
Full URL of the request.
Definition at line 144 of file HTTPMessage.h.
|
protected |
Any data attached to the request by the class client.
Definition at line 160 of file HTTPMessage.h.