EHS Embedded HTTP Server  1.5.0.132
HttpRequest Class Reference

This class represents a clients HTTP request. More...

#include <httprequest.h>

List of all members.

Public Member Functions

virtual ~HttpRequest ()
 Destructor.
std::string RemoteAddress ()
 Retrieves the peer's IP address.
int RemotePort ()
 Retrieves the peer's port.
std::string LocalAddress ()
 Retrieves the local IP address.
int LocalPort ()
 Retrieves the local port.
std::string Address ()
 Retrieves the peer's IP address.
int Port ()
 Retrieves the peer's port.
int Id () const
 Retrieves this request's Id.
EHSConnectionConnection () const
 Retrieves the receiving connection.
RequestMethod Method () const
 Retrieves the request method.
bool Secure () const
 Retrieves the security status.
bool ClientDisconnected ()
 Retrieves the client connection status.
const std::string & Uri () const
 Retrieves this request's URI.
const std::string & HttpVersion () const
 Retrieves the HTTP version.
const std::string & Body () const
 Retrieves this request's body.
StringCaseMap & Headers ()
 Retrieves HTTP headers.
FormValueMap & FormValues ()
 Retrieves form values.
CookieMap & Cookies ()
 Retrieves cookies.
FormValueFormValues (const std::string &name)
 Retrieves a specific form value.
std::string Headers (const std::string &name)
 Retrieves a specific HTTP header.
void SetHeader (const std::string &name, const std::string &value)
 Sets a single request header.
std::string Cookies (const std::string &name)
 Retrieves a specific cookie value.

Friends

class EHSConnection
class EHS

Detailed Description

This class represents a clients HTTP request.

It contans pre-parsed data like cookies, form data and header information.

Examples:

ehs_basicauth.cpp, ehs_exception.cpp, ehs_formtest.cpp, ehs_mirror.cpp, ehs_privport.cpp, ehs_test.cpp, ehs_testharness.cpp, ehs_uploader.cpp, and ehs_wsgate.cpp.


Member Function Documentation

std::string Address ( ) [inline]

Retrieves the peer's IP address.

Returns:
The IP address of the peer that sent this request as dot-quad.
Deprecated:
Use RemoteAddress()

Definition at line 97 of file httprequest.h.

References RemoteAddress().

+ Here is the call graph for this function:

const std::string& Body ( ) const [inline]

Retrieves this request's body.

Returns:
The body content of this request.
Examples:
ehs_basicauth.cpp, ehs_privport.cpp, and ehs_testharness.cpp.

Definition at line 153 of file httprequest.h.

bool ClientDisconnected ( )

Retrieves the client connection status.

Returns:
true if the client is disconnected.
EHSConnection* Connection ( ) const [inline]

Retrieves the receiving connection.

Returns:
The connection on which this request was received.

Definition at line 117 of file httprequest.h.

CookieMap& Cookies ( ) [inline]

Retrieves cookies.

Returns:
All cookies of this request.
Examples:
ehs_basicauth.cpp, ehs_privport.cpp, ehs_test.cpp, ehs_testharness.cpp, and ehs_uploader.cpp.

Definition at line 171 of file httprequest.h.

std::string Cookies ( const std::string &  name) [inline]

Retrieves a specific cookie value.

Parameters:
nameThe name of the cookie to be retrieved.
Returns:
The value of the specified cookie.

Definition at line 213 of file httprequest.h.

FormValueMap& FormValues ( ) [inline]

Retrieves form values.

Returns:
All form values of this request.
Examples:
ehs_basicauth.cpp, ehs_formtest.cpp, ehs_privport.cpp, ehs_testharness.cpp, and ehs_uploader.cpp.

Definition at line 165 of file httprequest.h.

FormValue& FormValues ( const std::string &  name) [inline]

Retrieves a specific form value.

Parameters:
nameThe name of the form element to be retrieved.
Returns:
The value of the specified form element.

Definition at line 178 of file httprequest.h.

StringCaseMap& Headers ( ) [inline]

Retrieves HTTP headers.

Returns:
A StringCaseMap of the HTTP headers from this request.
Examples:
ehs_basicauth.cpp, ehs_privport.cpp, ehs_testharness.cpp, and ehs_wsgate.cpp.

Definition at line 159 of file httprequest.h.

std::string Headers ( const std::string &  name) [inline]

Retrieves a specific HTTP header.

Parameters:
nameThe name of the HTTP header to be retrieved.
Returns:
The value of the specified header.

Definition at line 188 of file httprequest.h.

const std::string& HttpVersion ( ) const [inline]

Retrieves the HTTP version.

Returns:
The HTTP version string as received in the request header.
Examples:
ehs_basicauth.cpp, ehs_privport.cpp, ehs_testharness.cpp, and ehs_wsgate.cpp.

Definition at line 147 of file httprequest.h.

int Id ( ) const [inline]

Retrieves this request's Id.

Returns:
The unique Id that was generated by EHS.

Definition at line 111 of file httprequest.h.

std::string LocalAddress ( )

Retrieves the local IP address.

Returns:
The local IP address where this request was received as dot-quad.
int LocalPort ( )

Retrieves the local port.

Returns:
The local port where this request was received.
RequestMethod Method ( ) const [inline]

Retrieves the request method.

Returns:
The numeric request method of this request.
Examples:
ehs_basicauth.cpp, ehs_privport.cpp, ehs_testharness.cpp, and ehs_wsgate.cpp.

Definition at line 123 of file httprequest.h.

int Port ( ) [inline]

Retrieves the peer's port.

Returns:
The peer port that sent this request.
Deprecated:
Use RemotePort()

Definition at line 105 of file httprequest.h.

References RemotePort().

+ Here is the call graph for this function:

std::string RemoteAddress ( )

Retrieves the peer's IP address.

Returns:
The IP address of the peer that sent this request as dot-quad.
Examples:
ehs_basicauth.cpp, ehs_mirror.cpp, ehs_privport.cpp, and ehs_testharness.cpp.

Referenced by Address().

+ Here is the caller graph for this function:

int RemotePort ( )

Retrieves the peer's port.

Returns:
The peer port that sent this request.
Examples:
ehs_basicauth.cpp, ehs_mirror.cpp, ehs_privport.cpp, and ehs_testharness.cpp.

Referenced by Port().

+ Here is the caller graph for this function:

bool Secure ( ) const [inline]

Retrieves the security status.

Returns:
true if this request was received via SSL, false otherwise.
Examples:
ehs_mirror.cpp.

Definition at line 129 of file httprequest.h.

void SetHeader ( const std::string &  name,
const std::string &  value 
) [inline]

Sets a single request header.

This method is intended for generating synthetic headers (for example when implementing HTTP basic authentication).

Parameters:
nameThe name of the HTTP header to be set.
valueThe value of the HTTP header to be set.
Examples:
ehs_basicauth.cpp.

Definition at line 203 of file httprequest.h.

const std::string& Uri ( ) const [inline]

Retrieves this request's URI.

Returns:
The request URI of this request.
Examples:
ehs_basicauth.cpp, ehs_exception.cpp, ehs_privport.cpp, ehs_testharness.cpp, ehs_uploader.cpp, and ehs_wsgate.cpp.

Definition at line 141 of file httprequest.h.


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