Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
HttpRequest Struct Reference

Detailed Description

The HttpServer creates an HttpRequest object when the HttpServer parses a client request.

The object is passed in as the first argument to the HttpPage service function. Request-owned pointers (headers, parameters, cookies, URI, and associated command objects) must not be freed or retained beyond request completion. Access requires the server mutex. Copy data needed by asynchronous work.

#include <HttpServer.h>

Public Member Functions

int checkMethods (HttpResponse *resp, U32 methods, bool addDefault=TRUE)
 Checks the HTTP method type and sends a response message if condition met. More...
 
BaBool checkTime (struct HttpResponse *resp, BaTime time)
 Parses and checks if the "If-Modified-Since" time is equal or greater than "time". More...
 
AuthenticatedUser * getAuthenticatedUser ()
 Returns the authenticated user or NULL if user is not authenticated. More...
 
const char * getRequestURI ()
 Returns the pathname. More...
 
const char * getRequestURL (bool forceHttps=false)
 Reconstructs the URL the client used to make the request. More...
 
HttpStdHeaders * getStdHeaders ()
 Returns an object containing standard HTTP headers. More...
 
const char * getVersion ()
 Returns the HTTP version as a string, normally "1.1". More...
 
const char * getHeaderValue (const char *name)
 Returns the value of the specified request header. More...
 
HttpCookie * getCookie (const char *name)
 Returns the requested cookie or NULL if no cookie matches the name. More...
 
HttpMethod getMethodType ()
 Returns the method type. More...
 
const char * getMethod ()
 Returns a string representation of the value returned by HttpRequest::getMethodType. More...
 
const char * getParameter (const char *paramName)
 Returns the value of a request parameter as a const char* or null if the parameter does not exist. More...
 
int wsUpgrade ()
 Validate and send an HTTP/1.1 WebSocket version-13 handshake. More...
 
HttpHeader * getHeaders (int *len)
 Return an HTTP header iterator that can iterate and fetch all the HTTP headers. More...
 
HttpSession * getSession (BaBool create=true)
 Returns the current HttpSession associated with this request, or if there is no current session and create is true, returns a new session. More...
 
HttpConnection * getConnection ()
 Returns the connection object associated with this request. More...
 
HttpServer * getServer ()
 Returns the web server object. More...
 
HttpResponse * getResponse ()
 Returns the HttpResponse object. More...
 
HttpCommand * getCommand ()
 Get the HttpCommand object. More...
 
HttpInData * getBuffer ()
 Get the internal rec buffer. More...
 

Static Public Member Functions

static const char * getMethod (HttpMethod method)
 Returns a string representation of the argument. More...