Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Types | Public Member Functions | Protected Types | Protected Attributes | List of all members
cHTTPMessage Class Reference

#include <HTTPMessage.h>

Inheritance diagram for cHTTPMessage:
Inheritance graph
[legend]

Public Types

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)
 Adds a header into the internal map of headers. More...
 
 cHTTPMessage (eKind a_Kind)
 
size_t GetContentLength (void) const
 
const AStringGetContentType (void) const
 
void SetContentLength (size_t a_ContentLength)
 
void SetContentType (const AString &a_ContentType)
 
virtual ~cHTTPMessage ()
 

Protected Types

using cNameValueMap = std::map< AString, AString >
 

Protected Attributes

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
 

Detailed Description

Definition at line 16 of file HTTPMessage.h.

Member Typedef Documentation

◆ cNameValueMap

using cHTTPMessage::cNameValueMap = std::map<AString, AString>
protected

Definition at line 47 of file HTTPMessage.h.

Member Enumeration Documentation

◆ eKind

Enumerator
mkRequest 
mkResponse 

Definition at line 25 of file HTTPMessage.h.

◆ eStatus

Enumerator
HTTP_OK 
HTTP_BAD_REQUEST 

Definition at line 19 of file HTTPMessage.h.

Constructor & Destructor Documentation

◆ cHTTPMessage()

cHTTPMessage::cHTTPMessage ( eKind  a_Kind)

Definition at line 26 of file HTTPMessage.cpp.

◆ ~cHTTPMessage()

virtual cHTTPMessage::~cHTTPMessage ( )
inlinevirtual

Definition at line 34 of file HTTPMessage.h.

Member Function Documentation

◆ AddHeader()

void cHTTPMessage::AddHeader ( const AString a_Key,
const AString a_Value 
)
virtual

Adds a header into the internal map of headers.

Recognizes special headers: Content-Type and Content-Length

Reimplemented in cHTTPIncomingRequest.

Definition at line 36 of file HTTPMessage.cpp.

◆ GetContentLength()

size_t cHTTPMessage::GetContentLength ( void  ) const
inline

Definition at line 43 of file HTTPMessage.h.

◆ GetContentType()

const AString& cHTTPMessage::GetContentType ( void  ) const
inline

Definition at line 42 of file HTTPMessage.h.

◆ SetContentLength()

void cHTTPMessage::SetContentLength ( size_t  a_ContentLength)
inline

Definition at line 40 of file HTTPMessage.h.

◆ SetContentType()

void cHTTPMessage::SetContentType ( const AString a_ContentType)
inline

Definition at line 39 of file HTTPMessage.h.

Member Data Documentation

◆ m_ContentLength

size_t cHTTPMessage::m_ContentLength
protected

Length of the content that is to be received.

AString::npos when the object is created. Parsed by AddHeader() or set directly by SetContentLength()

Definition at line 61 of file HTTPMessage.h.

◆ m_ContentType

AString cHTTPMessage::m_ContentType
protected

Type of the content; parsed by AddHeader(), set directly by SetContentLength()

Definition at line 56 of file HTTPMessage.h.

◆ m_Headers

AStringMap cHTTPMessage::m_Headers
protected

Map of headers, with their keys lowercased.

Definition at line 53 of file HTTPMessage.h.

◆ m_Kind

eKind cHTTPMessage::m_Kind
protected

Definition at line 50 of file HTTPMessage.h.


The documentation for this class was generated from the following files: