A base class for HTTP text parsing classes. More...
#include <httpmessage.h>
Public Types | |
typedef HeaderFieldContainer::const_iterator | ConstHeaderFieldIterator |
Const Iterator type for Header Fields in this class. | |
typedef std::vector< HeaderField > | HeaderFieldContainer |
Container type for Header Fields in this class. | |
typedef HeaderFieldContainer::iterator | HeaderFieldIterator |
Iterator type for Header Fields in this class. | |
typedef String::const_iterator | StringIterator |
Convenience typedef for String iterators. | |
Public Member Functions | |
virtual String | Compose () const =0 |
Creates a completed Message that can be sent across an HTTP connection. More... | |
virtual Boole | Decompose (const String &Message)=0 |
Populates the members of this class with data from a text HTTP Message. More... | |
virtual Boole | Decompose (StringIterator &CurrIt, const StringIterator EndIt)=0 |
Populates the members of this class with data from a text HTTP Message. More... | |
const String & | GetBody () const |
Gets the message body containing additional information. More... | |
const String & | GetConnectionHeader () const |
Gets the Connection Header. More... | |
const String & | GetContentLengthHeader () const |
Gets the Content-Length Header. More... | |
const String & | GetContentTypeHeader () const |
Gets the Content-Type Header. More... | |
const String & | GetField (const String &FieldName) const |
Gets a Name-Value pair for a header field in the message. More... | |
UInt16 | GetHTTPMajorVersion () const |
Gets the major version of this message. More... | |
UInt16 | GetHTTPMinorVersion () const |
Gets the minor version of this message. More... | |
const SimpleVersion & | GetHTTPVersion () const |
Gets both the major and minor version of this message. More... | |
Whole | GetMaxFields () const |
Gets how many header fields can be added to this message during parsing. More... | |
Boole | HasField (const String &FieldName) const |
Checks if this message has the named header field. More... | |
void | RemoveAllFields () |
Removes every field from this message. | |
void | RemoveField (const String &FieldName) |
Removes a specific field from this message by name. More... | |
void | SetBody (const String &Body) |
Sets the message body containing additional information. More... | |
void | SetConnectionHeader (const String &Connection) |
Sets the Connection Header. More... | |
void | SetContentLengthHeader (const String &ContentLength) |
Sets the Content-Length Header. More... | |
void | SetContentTypeHeader (const String &ContentType) |
Sets the Content-Type Header. More... | |
void | SetField (const String &FieldName, const String &FieldValue) |
Sets a Name-Value pair for a header field in the message. More... | |
void | SetHTTPMajorVersion (const UInt16 Major) |
Sets the major version of this message. More... | |
void | SetHTTPMinorVersion (const UInt16 Minor) |
Sets the minor version of this message. More... | |
void | SetHTTPVersion (const SimpleVersion &Version) |
Sets both the major and minor version of this message via SimpleVersion. More... | |
void | SetHTTPVersion (const UInt16 Major, const UInt16 Minor) |
Sets both the major and minor version of this message. More... | |
void | SetMaxFields (const Whole MaxFields) |
Sets how many header fields can be added to this message during parsing. More... | |
Protected Member Functions | |
HTTPMessage () | |
Blank Constructor. | |
HTTPMessage (const UInt16 VerMajor, const UInt16 VerMinor) | |
UInt Version Constructor. | |
HTTPMessage (const SimpleVersion &Version) | |
Version Constructor. | |
virtual | ~HTTPMessage () |
Class destructor. | |
void | AdvanceToNewline (StringIterator &CurrIt, const StringIterator EndIt) |
Convenience method that will ignore and advance passed all characters until one passed the first newline character detected. More... | |
Boole | GetMessageComponent (StringIterator &CurrIt, const StringIterator EndIt, String &Component) |
Extracts all characters from CurrIt until the first space encountered or EndIt, whichever comes first. More... | |
Boole | ParseHTTPFields (StringIterator &CurrIt, const StringIterator EndIt) |
Parses the HTTP fields from a provided string. More... | |
virtual Boole | ParseHTTPHeader (StringIterator &CurrIt, const StringIterator EndIt)=0 |
Parses the information contained in the Message Header. More... | |
Boole | ParseHTTPVersion (const String &ToParse) |
Parses the HTTP version from a provided string. More... | |
Protected Attributes | |
Whole | MaxHeaderFields |
The maximum number of allowed header fields in this message. More... | |
String | MessageBody |
The body of the message. More... | |
HeaderFieldContainer | MessageFields |
A container of fields to populate the message header with. More... | |
SimpleVersion | MessageVersion |
The version component for this response. More... | |
A base class for HTTP text parsing classes.
Definition at line 73 of file httpmessage.h.
|
protected |
Convenience method that will ignore and advance passed all characters until one passed the first newline character detected.
CurrIt | An iterator to the current character being processed in the string being parsed. |
EndIt | An iterator to the last character in the string to be parsed. |
Definition at line 197 of file httpmessage.cpp.
|
pure virtual |
Creates a completed Message that can be sent across an HTTP connection.
Implemented in Mezzanine::Network::HTTPRequest, and Mezzanine::Network::HTTPResponse.
Populates the members of this class with data from a text HTTP Message.
Message | The String containing the Message to be decomposed. |
Implemented in Mezzanine::Network::HTTPRequest, and Mezzanine::Network::HTTPResponse.
|
pure virtual |
Populates the members of this class with data from a text HTTP Message.
CurrIt | An iterator at the start of the range to be parsed. |
EndIt | An iterator at the end of the range to be parsed. Parsing may or may not reach this point. |
Implemented in Mezzanine::Network::HTTPRequest, and Mezzanine::Network::HTTPResponse.
const String & Mezzanine::Network::HTTPMessage::GetBody | ( | ) | const |
Gets the message body containing additional information.
Definition at line 239 of file httpmessage.cpp.
const String & Mezzanine::Network::HTTPMessage::GetConnectionHeader | ( | ) | const |
Gets the Connection Header.
Definition at line 324 of file httpmessage.cpp.
const String & Mezzanine::Network::HTTPMessage::GetContentLengthHeader | ( | ) | const |
Gets the Content-Length Header.
Definition at line 330 of file httpmessage.cpp.
const String & Mezzanine::Network::HTTPMessage::GetContentTypeHeader | ( | ) | const |
Gets the Content-Type Header.
Definition at line 336 of file httpmessage.cpp.
Gets a Name-Value pair for a header field in the message.
FieldName | The name of the field to retrieve. |
Definition at line 263 of file httpmessage.cpp.
UInt16 Mezzanine::Network::HTTPMessage::GetHTTPMajorVersion | ( | ) | const |
Gets the major version of this message.
Definition at line 227 of file httpmessage.cpp.
UInt16 Mezzanine::Network::HTTPMessage::GetHTTPMinorVersion | ( | ) | const |
Gets the minor version of this message.
Definition at line 233 of file httpmessage.cpp.
const SimpleVersion & Mezzanine::Network::HTTPMessage::GetHTTPVersion | ( | ) | const |
Gets both the major and minor version of this message.
Definition at line 218 of file httpmessage.cpp.
Whole Mezzanine::Network::HTTPMessage::GetMaxFields | ( | ) | const |
Gets how many header fields can be added to this message during parsing.
Definition at line 245 of file httpmessage.cpp.
|
protected |
Extracts all characters from CurrIt until the first space encountered or EndIt, whichever comes first.
CurrIt | An iterator to the current character being processed in the string being parsed. |
EndIt | An iterator to the last character in the string to be parsed. |
Component | The string to which the extracted characters will be appended. |
Definition at line 177 of file httpmessage.cpp.
Checks if this message has the named header field.
FieldName | The name of the field to check for. |
Definition at line 281 of file httpmessage.cpp.
|
protected |
Parses the HTTP fields from a provided string.
CurrIt | An iterator to the current character being processed in the string being parsed. |
EndIt | An iterator to the last character in the string to be parsed. |
Definition at line 126 of file httpmessage.cpp.
|
protectedpure virtual |
Parses the information contained in the Message Header.
CurrIt | An iterator to the current character being processed in the string being parsed. |
EndIt | An iterator to the last character in the string to be parsed. |
Implemented in Mezzanine::Network::HTTPRequest, and Mezzanine::Network::HTTPResponse.
Parses the HTTP version from a provided string.
ToParse | The String to retrieve the version information from. |
Definition at line 113 of file httpmessage.cpp.
void Mezzanine::Network::HTTPMessage::RemoveField | ( | const String & | FieldName | ) |
Removes a specific field from this message by name.
FieldName | The name of the field to be removed. |
Definition at line 296 of file httpmessage.cpp.
void Mezzanine::Network::HTTPMessage::SetBody | ( | const String & | Body | ) |
Sets the message body containing additional information.
Body | The body of the message. |
Definition at line 236 of file httpmessage.cpp.
void Mezzanine::Network::HTTPMessage::SetConnectionHeader | ( | const String & | Connection | ) |
Sets the Connection Header.
Connection | Control options for the current HTTP connection. |
Definition at line 321 of file httpmessage.cpp.
void Mezzanine::Network::HTTPMessage::SetContentLengthHeader | ( | const String & | ContentLength | ) |
Sets the Content-Length Header.
ContentLength | The length of the message body in bytes. |
Definition at line 327 of file httpmessage.cpp.
void Mezzanine::Network::HTTPMessage::SetContentTypeHeader | ( | const String & | ContentType | ) |
Sets the Content-Type Header.
ContentType | One or more descriptors on how the data in the message body is presented, such if it's plain text, XML, or a form. |
Definition at line 333 of file httpmessage.cpp.
void Mezzanine::Network::HTTPMessage::SetField | ( | const String & | FieldName, |
const String & | FieldValue | ||
) |
Sets a Name-Value pair for a header field in the message.
FieldName | The name of the field to be set. |
FieldValue | The value to be set for the named header field. |
Definition at line 248 of file httpmessage.cpp.
void Mezzanine::Network::HTTPMessage::SetHTTPMajorVersion | ( | const UInt16 | Major | ) |
Sets the major version of this message.
Major | The major portion of the version to set. |
Definition at line 224 of file httpmessage.cpp.
void Mezzanine::Network::HTTPMessage::SetHTTPMinorVersion | ( | const UInt16 | Minor | ) |
Sets the minor version of this message.
Minor | The minor portion of the version to set. |
Definition at line 230 of file httpmessage.cpp.
void Mezzanine::Network::HTTPMessage::SetHTTPVersion | ( | const SimpleVersion & | Version | ) |
Sets both the major and minor version of this message via SimpleVersion.
Version | The version to be applied to this message. |
Definition at line 215 of file httpmessage.cpp.
Sets both the major and minor version of this message.
Major | The major portion of the version to set. |
Minor | The minor portion of the version to set. |
Definition at line 221 of file httpmessage.cpp.
void Mezzanine::Network::HTTPMessage::SetMaxFields | ( | const Whole | MaxFields | ) |
Sets how many header fields can be added to this message during parsing.
MaxFields | The maximum number of header fields that can be parsed by this message. Initial value: 100. |
Definition at line 242 of file httpmessage.cpp.
|
protected |
The maximum number of allowed header fields in this message.
Definition at line 87 of file httpmessage.h.
|
protected |
The body of the message.
Definition at line 93 of file httpmessage.h.
|
protected |
A container of fields to populate the message header with.
Definition at line 96 of file httpmessage.h.
|
protected |
The version component for this response.
Definition at line 90 of file httpmessage.h.