Message
Message
#include <icy/http/message.h>class MessageDefined in src/http/include/icy/http/message.h:28
Inherits:
NVCollectionSubclassed by:Request,Response
The base class for Request and Response.
Defines the common properties of all HTTP messages. These are version, content length, content type and transfer encoding.
List of all members
| Name | Kind | Owner |
|---|---|---|
setVersion | function | Declared here |
getVersion | function | Declared here |
setContentLength | function | Declared here |
getContentLength | function | Declared here |
hasContentLength | function | Declared here |
setTransferEncoding | function | Declared here |
getTransferEncoding | function | Declared here |
setChunkedTransferEncoding | function | Declared here |
isChunkedTransferEncoding | function | Declared here |
setContentType | function | Declared here |
getContentType | function | Declared here |
setKeepAlive | function | Declared here |
getKeepAlive | function | Declared here |
write | function | Declared here |
write | function | Declared here |
write | function | Declared here |
HTTP_1_0 | variable | Declared here |
HTTP_1_1 | variable | Declared here |
IDENTITY_TRANSFER_ENCODING | variable | Declared here |
CHUNKED_TRANSFER_ENCODING | variable | Declared here |
UNKNOWN_CONTENT_LENGTH | variable | Declared here |
UNKNOWN_CONTENT_TYPE | variable | Declared here |
CONTENT_LENGTH | variable | Declared here |
CONTENT_TYPE | variable | Declared here |
TRANSFER_ENCODING | variable | Declared here |
CONNECTION | variable | Declared here |
CONNECTION_KEEP_ALIVE | variable | Declared here |
CONNECTION_CLOSE | variable | Declared here |
EMPTY | variable | Declared here |
_version | variable | Declared here |
Message | function | Declared here |
Message | function | Declared here |
~Message | function | Declared here |
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 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 |
Public Methods
| Return | Name | Description |
|---|---|---|
void | setVersion | Sets the HTTP version for this message. |
const std::string & | getVersion const | Returns the HTTP version for this message. |
void | setContentLength | Sets the Content-Length header. |
uint64_t | getContentLength const | Returns the content length for this message, which may be UNKNOWN_CONTENT_LENGTH if no Content-Length header is present. |
bool | hasContentLength const | Returns true if a Content-Length header is present. |
void | setTransferEncoding | Sets the transfer encoding for this message. |
const std::string & | getTransferEncoding const | Returns the transfer encoding used for this message. |
void | setChunkedTransferEncoding | If flag is true, sets the Transfer-Encoding header to chunked. Otherwise, removes the Transfer-Encoding header. |
bool | isChunkedTransferEncoding const | Returns true if the Transfer-Encoding header is set and its value is chunked. |
void | setContentType | Sets the content type for this message. |
const std::string & | getContentType const | Returns the content type for this message. |
void | setKeepAlive | Sets the value of the Connection header field. |
bool | getKeepAlive const | Returns true if |
void | write virtual const | Writes the message header to the given output stream. |
void | write virtual const | Writes the message header to the given output string. |
void | write virtual const | Writes the message header directly into a byte buffer. |
setVersion
void setVersion(const std::string & version)Defined in src/http/include/icy/http/message.h:32
Sets the HTTP version for this message.
getVersion
const
const std::string & getVersion() constDefined in src/http/include/icy/http/message.h:35
Returns the HTTP version for this message.
setContentLength
void setContentLength(uint64_t length)Defined in src/http/include/icy/http/message.h:41
Sets the Content-Length header.
If length is UNKNOWN_CONTENT_LENGTH, removes the Content-Length header.
getContentLength
const
uint64_t getContentLength() constDefined in src/http/include/icy/http/message.h:46
Returns the content length for this message, which may be UNKNOWN_CONTENT_LENGTH if no Content-Length header is present.
hasContentLength
const
bool hasContentLength() constDefined in src/http/include/icy/http/message.h:49
Returns true if a Content-Length header is present.
setTransferEncoding
void setTransferEncoding(const std::string & transferEncoding)Defined in src/http/include/icy/http/message.h:55
Sets the transfer encoding for this message.
The value should be either IDENTITY_TRANSFER_CODING or CHUNKED_TRANSFER_CODING.
getTransferEncoding
const
const std::string & getTransferEncoding() constDefined in src/http/include/icy/http/message.h:62
Returns the transfer encoding used for this message.
Normally, this is the value of the Transfer-Encoding header field. If no such field is present, returns IDENTITY_TRANSFER_CODING.
setChunkedTransferEncoding
void setChunkedTransferEncoding(bool flag)Defined in src/http/include/icy/http/message.h:66
If flag is true, sets the Transfer-Encoding header to chunked. Otherwise, removes the Transfer-Encoding header.
isChunkedTransferEncoding
const
bool isChunkedTransferEncoding() constDefined in src/http/include/icy/http/message.h:70
Returns true if the Transfer-Encoding header is set and its value is chunked.
setContentType
void setContentType(const std::string & contentType)Defined in src/http/include/icy/http/message.h:76
Sets the content type for this message.
Specify NO_CONTENT_TYPE to remove the Content-Type header.
getContentType
const
const std::string & getContentType() constDefined in src/http/include/icy/http/message.h:82
Returns the content type for this message.
If no Content-Type header is present, returns UNKNOWN_CONTENT_TYPE.
setKeepAlive
void setKeepAlive(bool keepAlive)Defined in src/http/include/icy/http/message.h:88
Sets the value of the Connection header field.
The value is set to "Keep-Alive" if keepAlive is true, or to "Close" otherwise.
getKeepAlive
const
bool getKeepAlive() constDefined in src/http/include/icy/http/message.h:94
Returns true if
the message has a Connection header field and its value is "Keep-Alive"
the message is an HTTP/1.1 message and no Connection header is set Returns false otherwise.
write
virtual const
virtual void write(std::ostream & ostr) constDefined in src/http/include/icy/http/message.h:102
Writes the message header to the given output stream.
The format is one name-value pair per line, with name and value separated by a colon and lines delimited by a carriage return and a linefeed character. See RFC 2822 for details.
Reimplemented by
write
virtual const
virtual void write(std::string & str) constDefined in src/http/include/icy/http/message.h:105
Writes the message header to the given output string.
Reimplemented by
write
virtual const
virtual void write(Buffer & buf) constDefined in src/http/include/icy/http/message.h:108
Writes the message header directly into a byte buffer.
Reimplemented by
Public Static Attributes
| Return | Name | Description |
|---|---|---|
const std::string | HTTP_1_0 static | |
const std::string | HTTP_1_1 static | |
const std::string | IDENTITY_TRANSFER_ENCODING static | |
const std::string | CHUNKED_TRANSFER_ENCODING static | |
const int | UNKNOWN_CONTENT_LENGTH static | |
const std::string | UNKNOWN_CONTENT_TYPE static | |
const std::string | CONTENT_LENGTH static | |
const std::string | CONTENT_TYPE static | |
const std::string | TRANSFER_ENCODING static | |
const std::string | CONNECTION static | |
const std::string | CONNECTION_KEEP_ALIVE static | |
const std::string | CONNECTION_CLOSE static | |
const std::string | EMPTY static |
HTTP_1_0
static
const std::string HTTP_1_0Defined in src/http/include/icy/http/message.h:110
HTTP_1_1
static
const std::string HTTP_1_1Defined in src/http/include/icy/http/message.h:111
IDENTITY_TRANSFER_ENCODING
static
const std::string IDENTITY_TRANSFER_ENCODINGDefined in src/http/include/icy/http/message.h:113
CHUNKED_TRANSFER_ENCODING
static
const std::string CHUNKED_TRANSFER_ENCODINGDefined in src/http/include/icy/http/message.h:114
UNKNOWN_CONTENT_LENGTH
static
const int UNKNOWN_CONTENT_LENGTHDefined in src/http/include/icy/http/message.h:116
UNKNOWN_CONTENT_TYPE
static
const std::string UNKNOWN_CONTENT_TYPEDefined in src/http/include/icy/http/message.h:117
CONTENT_LENGTH
static
const std::string CONTENT_LENGTHDefined in src/http/include/icy/http/message.h:119
CONTENT_TYPE
static
const std::string CONTENT_TYPEDefined in src/http/include/icy/http/message.h:120
TRANSFER_ENCODING
static
const std::string TRANSFER_ENCODINGDefined in src/http/include/icy/http/message.h:121
CONNECTION
static
const std::string CONNECTIONDefined in src/http/include/icy/http/message.h:122
CONNECTION_KEEP_ALIVE
static
const std::string CONNECTION_KEEP_ALIVEDefined in src/http/include/icy/http/message.h:124
CONNECTION_CLOSE
static
const std::string CONNECTION_CLOSEDefined in src/http/include/icy/http/message.h:125
EMPTY
static
const std::string EMPTYDefined in src/http/include/icy/http/message.h:127
Protected Attributes
| Return | Name | Description |
|---|---|---|
std::string | _version |
_version
std::string _versionDefined in src/http/include/icy/http/message.h:130
Protected Methods
| Return | Name | Description |
|---|---|---|
Message | Creates the Message with version HTTP/1.0. | |
Message | Creates the Message and sets the version. | |
~Message virtual | Destroys the Message. |
Message
Message()Defined in src/http/include/icy/http/message.h:133
Creates the Message with version HTTP/1.0.
Message
Message(const std::string & version)Defined in src/http/include/icy/http/message.h:137
Creates the Message and sets the version.
~Message
virtual
virtual ~Message()Defined in src/http/include/icy/http/message.h:140
Destroys the Message.
