The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

HTTPRequest Class Reference

This class represents a HTTP request. More...

#include <httpd.h>

Inheritance diagram for HTTPRequest:

Inheritance graph
[legend]
Collaboration diagram for HTTPRequest:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 HTTPRequest (const std::string &request_type, const std::string &uri, HTTPHeaders *hdr, void *opaque, const std::string &ip, const std::string &pdata)
 Initialize HTTPRequest.
std::stringGetPostData ()
 Get the post data (request content).
std::stringGetType ()
 Get the request type.
std::stringGetURI ()
 Get URI.
std::stringGetIP ()
 Get IP address of requester.

Public Attributes

HTTPHeadersheaders
int errorcode
void * sock
 A socket pointer, which you must return in your HTTPDocument class if you reply to this request.

Protected Attributes

std::string type
std::string document
std::string ipaddr
std::string postdata

Detailed Description

This class represents a HTTP request.

It will be sent to all modules as the data section of an Event.

Definition at line 101 of file httpd.h.


Constructor & Destructor Documentation

HTTPRequest::HTTPRequest const std::string request_type,
const std::string uri,
HTTPHeaders hdr,
void *  opaque,
const std::string ip,
const std::string pdata
[inline]
 

Initialize HTTPRequest.

This constructor is called by m_httpd.so to initialize the class.

Parameters:
request_type The request type, e.g. GET, POST, HEAD
uri The URI, e.g. /page
hdr The headers sent with the request
opaque An opaque pointer used internally by m_httpd, which you must pass back to the module in your reply.
ip The IP address making the web request.
pdata The post data (content after headers) received with the request, up to Content-Length in size

Definition at line 128 of file httpd.h.


Member Function Documentation

std::string& HTTPRequest::GetIP  )  [inline]
 

Get IP address of requester.

The requesting system's ip address will be returned.

Returns:
The IP address as a string

Definition at line 164 of file httpd.h.

References ipaddr.

Referenced by ModuleHTTPAccessList::OnEvent().

std::string& HTTPRequest::GetPostData  )  [inline]
 

Get the post data (request content).

All post data will be returned, including carriage returns and linefeeds.

Returns:
The postdata

Definition at line 137 of file httpd.h.

References postdata.

Referenced by ModuleRpcJson::OnEvent().

std::string& HTTPRequest::GetType  )  [inline]
 

Get the request type.

Any request type can be intercepted, even ones which are invalid in the HTTP/1.1 spec.

Returns:
The request type, e.g. GET, POST, HEAD

Definition at line 146 of file httpd.h.

References type.

std::string& HTTPRequest::GetURI  )  [inline]
 

Get URI.

The URI string (URL minus hostname and scheme) will be provided by this function.

Returns:
The URI being requested

Definition at line 155 of file httpd.h.

References document.

Referenced by ModuleRpcJson::OnEvent(), ModuleHttpStats::OnEvent(), and ModuleHTTPAccessList::OnEvent().


Member Data Documentation

std::string HTTPRequest::document [protected]
 

Definition at line 105 of file httpd.h.

Referenced by GetURI().

int HTTPRequest::errorcode
 

Definition at line 112 of file httpd.h.

HTTPHeaders* HTTPRequest::headers
 

Definition at line 111 of file httpd.h.

Referenced by ModuleHTTPAccessList::OnEvent().

std::string HTTPRequest::ipaddr [protected]
 

Definition at line 106 of file httpd.h.

Referenced by GetIP().

std::string HTTPRequest::postdata [protected]
 

Definition at line 107 of file httpd.h.

Referenced by GetPostData().

void* HTTPRequest::sock
 

A socket pointer, which you must return in your HTTPDocument class if you reply to this request.

Definition at line 117 of file httpd.h.

Referenced by ModuleHTTPAccessList::BlockAccess(), ModuleRpcJson::OnEvent(), and ModuleHttpStats::OnEvent().

std::string HTTPRequest::type [protected]
 

Definition at line 104 of file httpd.h.

Referenced by GetType().


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