Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Poco::Net::HTTPMessage Class Reference

#include <HTTPMessage.h>

+ Inheritance diagram for Poco::Net::HTTPMessage:
+ Collaboration diagram for Poco::Net::HTTPMessage:

Public Member Functions

void setVersion (const std::string &version)
 
const std::string & getVersion () const
 Sets the HTTP version for this message.
 
void setContentLength (std::streamsize length)
 Returns the HTTP version for this message.
 
std::streamsize getContentLength () const
 
bool hasContentLength () const
 
void setTransferEncoding (const std::string &transferEncoding)
 Returns true iff a Content-Length header is present.
 
const std::string & getTransferEncoding () const
 
void setChunkedTransferEncoding (bool flag)
 
bool getChunkedTransferEncoding () const
 
void setContentType (const std::string &mediaType)
 
void setContentType (const MediaType &mediaType)
 
const std::string & getContentType () const
 Sets the content type for this message.
 
void setKeepAlive (bool keepAlive)
 
bool getKeepAlive () const
 
- Public Member Functions inherited from Poco::Net::MessageHeader
 MessageHeader ()
 
 MessageHeader (const MessageHeader &messageHeader)
 Creates the MessageHeader.
 
virtual ~MessageHeader ()
 
MessageHeaderoperator= (const MessageHeader &messageHeader)
 Destroys the MessageHeader.
 
virtual void write (std::ostream &ostr) const
 Assigns the content of another MessageHeader.
 
virtual void read (std::istream &istr)
 
int getFieldLimit () const
 
void setFieldLimit (int limit)
 
bool hasToken (const std::string &fieldName, const std::string &token) const
 
- 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.
 
NameValueCollectionoperator= (const NameValueCollection &nvc)
 Destroys the NameValueCollection.
 
NameValueCollectionoperator= (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_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 PROXY_CONNECTION
 
static const std::string CONNECTION_KEEP_ALIVE
 
static const std::string CONNECTION_CLOSE
 
static const std::string EMPTY
 

Protected Member Functions

 HTTPMessage ()
 
 HTTPMessage (const std::string &version)
 Creates the HTTPMessage with version HTTP/1.0.
 
 HTTPMessage (const HTTPMessage &other)
 
HTTPMessageoperator= (const HTTPMessage &other)
 Copy constructor.
 
virtual ~HTTPMessage ()
 Assignment operator.
 

Private Attributes

std::string _version
 Destroys the HTTPMessage.
 

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
 
- Static Public Member Functions inherited from Poco::Net::MessageHeader
static void splitElements (const std::string &s, std::vector< std::string > &elements, bool ignoreEmpty=true)
 
static void splitParameters (const std::string &s, std::string &value, NameValueCollection &parameters)
 
static void splitParameters (const std::string::const_iterator &begin, const std::string::const_iterator &end, NameValueCollection &parameters)
 
static void quote (const std::string &value, std::string &result, bool allowSpace=false)
 
static void decodeRFC2047 (const std::string &ins, std::string &outs, const std::string &charset="UTF-8")
 
static std::string decodeWord (const std::string &text, const std::string &charset="UTF-8")
 

Detailed Description

The base class for HTTPRequest and HTTPResponse.

Defines the common properties of all HTTP messages.
These are version, content length, content type
and transfer encoding. 

Definition at line 32 of file HTTPMessage.h.

Constructor & Destructor Documentation

◆ HTTPMessage() [1/3]

Poco::Net::HTTPMessage::HTTPMessage ( )
protected

◆ HTTPMessage() [2/3]

Poco::Net::HTTPMessage::HTTPMessage ( const std::string & version)
protected

Creates the HTTPMessage with version HTTP/1.0.

◆ HTTPMessage() [3/3]

Poco::Net::HTTPMessage::HTTPMessage ( const HTTPMessage & other)
protected

Creates the HTTPMessage and sets the version.

◆ ~HTTPMessage()

virtual Poco::Net::HTTPMessage::~HTTPMessage ( )
protectedvirtual

Assignment operator.

Member Function Documentation

◆ getChunkedTransferEncoding()

bool Poco::Net::HTTPMessage::getChunkedTransferEncoding ( ) const

If flag is true, sets the Transfer-Encoding header to chunked. Otherwise, removes the Transfer-Encoding header.

◆ getContentLength()

std::streamsize Poco::Net::HTTPMessage::getContentLength ( ) const

Sets the Content-Length header.

If length is UNKNOWN_CONTENT_LENGTH, removes the Content-Length header.

◆ getContentType()

const std::string & Poco::Net::HTTPMessage::getContentType ( ) const

Sets the content type for this message.

◆ getKeepAlive()

bool Poco::Net::HTTPMessage::getKeepAlive ( ) const

Sets the value of the Connection header field.

The value is set to "Keep-Alive" if keepAlive is true, or to "Close" otherwise.

◆ getTransferEncoding()

const std::string & Poco::Net::HTTPMessage::getTransferEncoding ( ) const

Sets the transfer encoding for this message.

The value should be either IDENTITY_TRANSFER_CODING or CHUNKED_TRANSFER_CODING.

◆ getVersion()

const std::string & Poco::Net::HTTPMessage::getVersion ( ) const
inline

Sets the HTTP version for this message.

Definition at line 174 of file HTTPMessage.h.

◆ hasContentLength()

bool Poco::Net::HTTPMessage::hasContentLength ( ) const
inline

Returns the content length for this message, which may be UNKNOWN_CONTENT_LENGTH if no Content-Length header is present.

Definition at line 180 of file HTTPMessage.h.

◆ operator=()

HTTPMessage & Poco::Net::HTTPMessage::operator= ( const HTTPMessage & other)
protected

Copy constructor.

◆ setChunkedTransferEncoding()

void Poco::Net::HTTPMessage::setChunkedTransferEncoding ( bool flag)

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.

◆ setContentLength()

void Poco::Net::HTTPMessage::setContentLength ( std::streamsize length)

Returns the HTTP version for this message.

+ Here is the caller graph for this function:

◆ setContentType() [1/2]

void Poco::Net::HTTPMessage::setContentType ( const MediaType & mediaType)

Sets the content type for this message.

Specify UNKNOWN_CONTENT_TYPE to remove the Content-Type header.

◆ setContentType() [2/2]

void Poco::Net::HTTPMessage::setContentType ( const std::string & mediaType)

Returns true if the Transfer-Encoding header is set and its value is chunked.

◆ setKeepAlive()

void Poco::Net::HTTPMessage::setKeepAlive ( bool keepAlive)

Returns the content type for this message.

If no Content-Type header is present, returns UNKNOWN_CONTENT_TYPE.

◆ setTransferEncoding()

void Poco::Net::HTTPMessage::setTransferEncoding ( const std::string & transferEncoding)

Returns true iff a Content-Length header is present.

◆ setVersion()

void Poco::Net::HTTPMessage::setVersion ( const std::string & version)

Member Data Documentation

◆ _version

std::string Poco::Net::HTTPMessage::_version
private

Destroys the HTTPMessage.

Definition at line 167 of file HTTPMessage.h.

◆ CHUNKED_TRANSFER_ENCODING

const std::string Poco::Net::HTTPMessage::CHUNKED_TRANSFER_ENCODING
static

Definition at line 133 of file HTTPMessage.h.

◆ CONNECTION

const std::string Poco::Net::HTTPMessage::CONNECTION
static

Definition at line 141 of file HTTPMessage.h.

◆ CONNECTION_CLOSE

const std::string Poco::Net::HTTPMessage::CONNECTION_CLOSE
static

Definition at line 145 of file HTTPMessage.h.

◆ CONNECTION_KEEP_ALIVE

const std::string Poco::Net::HTTPMessage::CONNECTION_KEEP_ALIVE
static

Definition at line 144 of file HTTPMessage.h.

◆ CONTENT_LENGTH

const std::string Poco::Net::HTTPMessage::CONTENT_LENGTH
static

Definition at line 138 of file HTTPMessage.h.

◆ CONTENT_TYPE

const std::string Poco::Net::HTTPMessage::CONTENT_TYPE
static

Definition at line 139 of file HTTPMessage.h.

◆ EMPTY

const std::string Poco::Net::HTTPMessage::EMPTY
static

Definition at line 147 of file HTTPMessage.h.

◆ HTTP_1_0

const std::string Poco::Net::HTTPMessage::HTTP_1_0
static

Returns true if

  • the message has a Connection header field and its value is "Keep-Alive"
  • the message is a HTTP/1.1 message and not Connection header is set Returns false otherwise.

Definition at line 129 of file HTTPMessage.h.

◆ HTTP_1_1

const std::string Poco::Net::HTTPMessage::HTTP_1_1
static

Definition at line 130 of file HTTPMessage.h.

◆ IDENTITY_TRANSFER_ENCODING

const std::string Poco::Net::HTTPMessage::IDENTITY_TRANSFER_ENCODING
static

Definition at line 132 of file HTTPMessage.h.

◆ PROXY_CONNECTION

const std::string Poco::Net::HTTPMessage::PROXY_CONNECTION
static

Definition at line 142 of file HTTPMessage.h.

◆ TRANSFER_ENCODING

const std::string Poco::Net::HTTPMessage::TRANSFER_ENCODING
static

Definition at line 140 of file HTTPMessage.h.

◆ UNKNOWN_CONTENT_LENGTH

const int Poco::Net::HTTPMessage::UNKNOWN_CONTENT_LENGTH
static

Definition at line 135 of file HTTPMessage.h.

◆ UNKNOWN_CONTENT_TYPE

const std::string Poco::Net::HTTPMessage::UNKNOWN_CONTENT_TYPE
static

Definition at line 136 of file HTTPMessage.h.


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