Logo Search packages:      
Sourcecode: poco version File versions  Download package

Poco::Net::HTTPRequest Class Reference

#include <HTTPRequest.h>

Inheritance diagram for Poco::Net::HTTPRequest:

Poco::Net::HTTPMessage Poco::Net::MessageHeader Poco::Net::NameValueCollection Poco::Net::HTTPServerRequest

List of all members.


Detailed Description

This class encapsulates an HTTP request message.

In addition to the properties common to all HTTP messages, a HTTP request has a method (e.g. GET, HEAD, POST, etc.) and a request URI.

Definition at line 51 of file HTTPRequest.h.


Public Types

typedef HeaderMap::const_iterator ConstIterator
typedef std::multimap
< std::string, std::string,
ILT > 
HeaderMap
typedef HeaderMap::iterator Iterator

Public Member Functions

void add (const std::string &name, const std::string &value)
 Sets the value of the (first) name-value pair with the given name.
ConstIterator begin () const
void clear ()
 Removes all name-value pairs with the given name.
bool empty () const
ConstIterator end () const
void erase (const std::string &name)
ConstIterator find (const std::string &name) const
const std::string & get (const std::string &name, const std::string &defaultValue) const
const std::string & get (const std::string &name) const
 Adds a new name-value pair with the given name and value.
bool getChunkedTransferEncoding () const
int getContentLength () const
const std::string & getContentType () const
 Sets the content type for this message.
void getCookies (NameValueCollection &cookies) const
void getCredentials (std::string &scheme, std::string &authInfo) const
const std::string & getHost () const
 Sets the value of the Host header field.
bool getKeepAlive () const
const std::string & getMethod () const
 Sets the method.
const std::string & getTransferEncoding () const
const std::string & getURI () const
 Sets the request URI.
const std::string & getVersion () const
 Sets the HTTP version for this message.
bool has (const std::string &name) const
bool hasCredentials () const
 HTTPRequest (const std::string &method, const std::string &uri, const std::string &version)
 Creates a HTTP/1.0 request with the given method and URI.
 HTTPRequest (const std::string &method, const std::string &uri)
 HTTPRequest (const std::string &version)
 Creates a GET / HTTP/1.0 HTTP request.
const std::string & operator[] (const std::string &name) const
 Swaps the NameValueCollection with another one.
void read (std::istream &istr)
void set (const std::string &name, const std::string &value)
void setChunkedTransferEncoding (bool flag)
void setContentLength (int length)
 Returns the HTTP version for this message.
void setContentType (const MediaType &mediaType)
void setContentType (const std::string &mediaType)
void setCookies (const NameValueCollection &cookies)
void setCredentials (const std::string &scheme, const std::string &authInfo)
void setHost (const std::string &host, Poco::UInt16 port)
 Sets the value of the Host header field.
void setHost (const std::string &host)
 Returns the request URI.
void setKeepAlive (bool keepAlive)
void setMethod (const std::string &method)
 Destroys the HTTPRequest.
void setTransferEncoding (const std::string &transferEncoding)
void setURI (const std::string &uri)
 Returns the method.
void setVersion (const std::string &version)
int size () const
 Returns true iff the header does not have any content.
void swap (NameValueCollection &nvc)
 Assigns the name-value pairs of another NameValueCollection to this one.
void write (std::ostream &ostr) const
virtual ~HTTPRequest ()
 Creates a HTTP request with the given method, URI and version.

Static Public Member Functions

static void quote (const std::string &value, std::string &result, bool allowSpace=false)
static void splitElements (const std::string &s, std::vector< std::string > &elements, bool ignoreEmpty=true)
static void splitParameters (const std::string::const_iterator &begin, const std::string::const_iterator &end, NameValueCollection &parameters)
static void splitParameters (const std::string &s, std::string &value, NameValueCollection &parameters)

Static Public Attributes

static const std::string AUTHORIZATION = "Authorization"
static const std::string CHUNKED_TRANSFER_ENCODING = "chunked"
static const std::string CONNECTION = "Connection"
static const std::string CONNECTION_CLOSE = "Close"
static const std::string CONNECTION_KEEP_ALIVE = "Keep-Alive"
static const std::string CONTENT_LENGTH = "Content-Length"
static const std::string CONTENT_TYPE = "Content-Type"
static const std::string COOKIE = "Cookie"
static const std::string HOST = "Host"
static const std::string HTTP_1_0 = "HTTP/1.0"
static const std::string HTTP_1_1 = "HTTP/1.1"
static const std::string HTTP_CONNECT = "CONNECT"
static const std::string HTTP_DELETE = "DELETE"
static const std::string HTTP_GET = "GET"
static const std::string HTTP_HEAD = "HEAD"
static const std::string HTTP_OPTIONS = "OPTIONS"
static const std::string HTTP_POST = "POST"
static const std::string HTTP_PUT = "PUT"
static const std::string HTTP_TRACE = "TRACE"
static const std::string IDENTITY_TRANSFER_ENCODING = "identity"
static const std::string TRANSFER_ENCODING = "Transfer-Encoding"
static const int UNKNOWN_CONTENT_LENGTH = -1
static const std::string UNKNOWN_CONTENT_TYPE

Private Types

enum  Limits { MAX_METHOD_LENGTH = 32, MAX_URI_LENGTH = 4096, MAX_VERSION_LENGTH = 8 }
 Limits for basic sanity checks when reading a header. More...

Private Attributes

std::string _method
std::string _uri

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

Generated by  Doxygen 1.6.0   Back to index