Public Member Functions

base_http::HTTPRequest Class Reference

A http request. More...

#include <libppbase/base_http/HTTPRequest.h>

Inheritance diagram for base_http::HTTPRequest:
base_http::HTTPPart base::MemFile base_http::HTTPResponse

List of all members.

Public Member Functions

 HTTPRequest ()
 Constructor.
 ~HTTPRequest ()
 Destructor.
void add (HTTPPart *part, bool own=false)
 Adds a mime part at the end of the part list.
int authenticate (const char *realm, const char *password, const char *lastnonce)
 Checks authentication.
bool getBasicAuthorization (base::String &username, base::String &password)
 Returns username and password from the basic authorization header.
const char * getBoundary () const
 Returns the mime boundary.
bool getDigestAuthorization (base::String &username, base::String &response)
 Returns the username and response from the digest authorization header.
int getMajorVersion () const
 Returns the major protocol version.
int getMinorVersion () const
 Returns the minor protocol version.
const char * getMethod () const
 Returns the http method.
HTTPPartgetPart (const base::String &id) const
 Returns a named mime part.
std::vector< HTTPPart * > getParts () const
 Returns all mime parts.
const char * getURI () const
 Returns the http request uri.
const char * getProtocol () const
 Returns the http protocol string.
void insert (HTTPPart *part, bool own=false)
 Inserts a new mime part as first part.
bool parseAuthorizationHeader (const base::String &header, base::String &method, std::map< base::String, base::String > &args)
 Parses the authorization header.
void setBoundary (const char *boundary)
 Sets a mime boundary.
void setMethod (const char *method)
 Sets a http method.
void setProtocol (const char *protocol)
 Sets a http protocol string.
void setURI (const char *uri)
 Sets a http uri.
size_t size () const
 Returns the size of this request.

Detailed Description

A http request.

Author:
Christoph Schwarz
Version:
$Id: HTTPRequest.h 21 2010-09-05 04:18:17Z cschwarz1 $

Member Function Documentation

void base_http::HTTPRequest::add ( HTTPPart part,
bool  own = false 
)

Adds a mime part at the end of the part list.

Parameters:
part the mime part to add
own flag: this object owns the part (=deletes it when this object is deleted)
int base_http::HTTPRequest::authenticate ( const char *  realm,
const char *  password,
const char *  lastnonce 
)

Checks authentication.

Parameters:
realm the realm
password the password
lastnonce the last nonce
Returns:
1=ok, 0=bad username or password, <0=other error
bool base_http::HTTPRequest::getBasicAuthorization ( base::String username,
base::String password 
)

Returns username and password from the basic authorization header.

Parameters:
username returns the username
password returns the password
Returns:
true if a authorization header with basic authorization was found, false if not
const char* base_http::HTTPRequest::getBoundary (  )  const

Returns the mime boundary.

Returns:
the mime boundary
bool base_http::HTTPRequest::getDigestAuthorization ( base::String username,
base::String response 
)

Returns the username and response from the digest authorization header.

Parameters:
username returns the username
response returns the response
Returns:
true if a authorization header with digest authorization was found, false if not
int base_http::HTTPRequest::getMajorVersion (  )  const

Returns the major protocol version.

Returns:
the major protocol version
const char* base_http::HTTPRequest::getMethod (  )  const

Returns the http method.

Returns:
the http method (GET, POST, ...)
int base_http::HTTPRequest::getMinorVersion (  )  const

Returns the minor protocol version.

Returns:
the minor protocol version
HTTPPart* base_http::HTTPRequest::getPart ( const base::String id  )  const

Returns a named mime part.

Parameters:
id the part content id
Returns:
NULL if there is no such part
std::vector<HTTPPart*> base_http::HTTPRequest::getParts (  )  const

Returns all mime parts.

Returns:
a vector containing all mime parts
const char* base_http::HTTPRequest::getProtocol (  )  const

Returns the http protocol string.

Returns:
the http protocol string
const char* base_http::HTTPRequest::getURI (  )  const

Returns the http request uri.

Returns:
the http request uri
void base_http::HTTPRequest::insert ( HTTPPart part,
bool  own = false 
)

Inserts a new mime part as first part.

Parameters:
part the new mime part
own flag: this object owns the part (=deletes it when this object is deleted)
bool base_http::HTTPRequest::parseAuthorizationHeader ( const base::String header,
base::String method,
std::map< base::String, base::String > &  args 
)

Parses the authorization header.

Parameters:
header the authorization header
method returns the authorization method
args returns arguments of the header
Returns:
true if an authorization header was found, false if not
void base_http::HTTPRequest::setBoundary ( const char *  boundary  ) 

Sets a mime boundary.

Parameters:
boundary the boundary to use
void base_http::HTTPRequest::setMethod ( const char *  method  ) 

Sets a http method.

Parameters:
method the http method
void base_http::HTTPRequest::setProtocol ( const char *  protocol  ) 

Sets a http protocol string.

Parameters:
protocol the http protocol string
void base_http::HTTPRequest::setURI ( const char *  uri  ) 

Sets a http uri.

Parameters:
uri the http uri
size_t base_http::HTTPRequest::size (  )  const

Returns the size of this request.

Returns:
the size in bytes

Reimplemented from base_http::HTTPPart.


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