HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NET_HTTPRequest Class Reference

#include <NET_HTTPRequest.h>

Public Types

enum  RequestType { kHTTP, kHTTPS }
 
using URLMap = UT_ArrayStringMap< UT_StringHolder >
 
using ReqMap = UT_ArrayStringMap< UT_StringHolder >
 
using Ranges = UT_Array< std::pair< int64, int64 >>
 
using PathChecker = std::function< NET_HTTPStatusCode(const UT_String &, const UT_String &)>
 

Public Member Functions

 NET_HTTPRequest ()
 
virtual ~NET_HTTPRequest ()=default
 
 operator bool () const
 
UT_StringHolder debugLine () const
 
UT_StringHolder protocol () const
 
UT_StringHolder contentLength () const
 
UT_StringHolder contentType () const
 
UT_StringHolder host () const
 
unsigned versionMaj () const
 
unsigned versionMin () const
 
const UT_StringHoldermethod () const
 
const UT_StringHolderpath () const
 
const UT_StringHolderqueryString () const
 
UT_Optional
< NET_HTTPUploadedFile & > 
getFile (const char *name)
 
UT_Optional< const
UT_StringHolder & > 
getHeaderOpt (const char *name) const
 
SYS_FORCE_INLINE bool hasHeader (const UT_StringRef &name) const
 
UT_Optional< const
UT_StringHolder & > 
getVariable (const char *name) const
 
SYS_FORCE_INLINE bool hasVariable (const UT_StringRef &name) const
 
UT_Optional< const
UT_StringHolder & > 
getUriVariable (const char *name) const
 
UT_Optional< const
UT_StringHolder & > 
getCookie (const char *name) const
 
const UT_StringHolderbody () const
 
bool isValid () const
 
void setClientIp (unsigned short ip[4])
 
void getClientIp (unsigned short ip[4]) const
 
UT_StringHolder clientIpStr () const
 
bool isWebSocketUpgrade () const
 
const NET_Timetimestamp () const
 
void setTimestamp (const NET_Time &t)
 
const NET_WebMapheaders () const
 
const ReqMapvariables () const
 
const ReqMapuriVariables () const
 
const ReqMapcookieJar () const
 
NET_HTTPStatusCode requestStatus () const
 
void clearStatus ()
 
bool canUseContentTypeInResponse (const UT_StringRef &ct)
 
SYS_FORCE_INLINE bool isSecure () const
 
bool generateWebSocketUpgradeResponse (NET_WebResponse &resp)
 
const UT_ArrayStringMap
< NET_HTTPUploadedFile > & 
files () const
 
UT_ArrayStringMap
< NET_HTTPUploadedFile > & 
files ()
 
bool isLocalRequest () const
 Helper to check if the request was a local request. More...
 

Static Public Member Functions

static bool matchesAcceptHeader (const UT_StringRef &header, const UT_StringRef &ct)
 
static UT_StringHolder sanitizePath (const UT_StringHolder &path)
 
static void parseRanges (const UT_StringHolder &header, Ranges &ranges)
 Parse out all ranges found in the header value. More...
 

Public Attributes

NET_WebMap myMetaData
 
int myPort
 
NET_WebStreammyStream
 

Protected Member Functions

void resetForRead ()
 

Friends

class NET_HttpIO
 

Detailed Description

Definition at line 37 of file NET_HTTPRequest.h.

Member Typedef Documentation

Definition at line 47 of file NET_HTTPRequest.h.

Definition at line 42 of file NET_HTTPRequest.h.

Member Enumeration Documentation

Enumerator
kHTTP 
kHTTPS 

Definition at line 49 of file NET_HTTPRequest.h.

Constructor & Destructor Documentation

NET_HTTPRequest::NET_HTTPRequest ( )
virtual NET_HTTPRequest::~NET_HTTPRequest ( )
virtualdefault

Member Function Documentation

const UT_StringHolder& NET_HTTPRequest::body ( ) const
inline

Definition at line 127 of file NET_HTTPRequest.h.

bool NET_HTTPRequest::canUseContentTypeInResponse ( const UT_StringRef ct)
void NET_HTTPRequest::clearStatus ( )
inline

Definition at line 170 of file NET_HTTPRequest.h.

UT_StringHolder NET_HTTPRequest::clientIpStr ( ) const
inline

Definition at line 148 of file NET_HTTPRequest.h.

UT_StringHolder NET_HTTPRequest::contentLength ( ) const
inline

Definition at line 70 of file NET_HTTPRequest.h.

UT_StringHolder NET_HTTPRequest::contentType ( ) const
inline

Definition at line 78 of file NET_HTTPRequest.h.

const ReqMap& NET_HTTPRequest::cookieJar ( ) const
inline

Definition at line 165 of file NET_HTTPRequest.h.

UT_StringHolder NET_HTTPRequest::debugLine ( ) const
const UT_ArrayStringMap<NET_HTTPUploadedFile>& NET_HTTPRequest::files ( ) const
inline

Definition at line 184 of file NET_HTTPRequest.h.

UT_ArrayStringMap<NET_HTTPUploadedFile>& NET_HTTPRequest::files ( )
inline

Definition at line 188 of file NET_HTTPRequest.h.

bool NET_HTTPRequest::generateWebSocketUpgradeResponse ( NET_WebResponse resp)
void NET_HTTPRequest::getClientIp ( unsigned short  ip[4]) const
inline

Definition at line 141 of file NET_HTTPRequest.h.

UT_Optional<const UT_StringHolder &> NET_HTTPRequest::getCookie ( const char *  name) const
UT_Optional<NET_HTTPUploadedFile &> NET_HTTPRequest::getFile ( const char *  name)
UT_Optional<const UT_StringHolder &> NET_HTTPRequest::getHeaderOpt ( const char *  name) const
UT_Optional<const UT_StringHolder &> NET_HTTPRequest::getUriVariable ( const char *  name) const
UT_Optional<const UT_StringHolder &> NET_HTTPRequest::getVariable ( const char *  name) const
SYS_FORCE_INLINE bool NET_HTTPRequest::hasHeader ( const UT_StringRef name) const
inline

Definition at line 112 of file NET_HTTPRequest.h.

SYS_FORCE_INLINE bool NET_HTTPRequest::hasVariable ( const UT_StringRef name) const
inline

Definition at line 118 of file NET_HTTPRequest.h.

const NET_WebMap& NET_HTTPRequest::headers ( ) const
inline

Definition at line 162 of file NET_HTTPRequest.h.

UT_StringHolder NET_HTTPRequest::host ( ) const
inline

Definition at line 86 of file NET_HTTPRequest.h.

bool NET_HTTPRequest::isLocalRequest ( ) const

Helper to check if the request was a local request.

SYS_FORCE_INLINE bool NET_HTTPRequest::isSecure ( ) const
inline

Definition at line 176 of file NET_HTTPRequest.h.

bool NET_HTTPRequest::isValid ( ) const
inline

Definition at line 132 of file NET_HTTPRequest.h.

bool NET_HTTPRequest::isWebSocketUpgrade ( ) const
static bool NET_HTTPRequest::matchesAcceptHeader ( const UT_StringRef header,
const UT_StringRef ct 
)
static
const UT_StringHolder& NET_HTTPRequest::method ( ) const
inline

Definition at line 104 of file NET_HTTPRequest.h.

NET_HTTPRequest::operator bool ( ) const
inlineexplicit

Definition at line 58 of file NET_HTTPRequest.h.

static void NET_HTTPRequest::parseRanges ( const UT_StringHolder header,
Ranges ranges 
)
static

Parse out all ranges found in the header value.

const UT_StringHolder& NET_HTTPRequest::path ( ) const
inline

Definition at line 106 of file NET_HTTPRequest.h.

UT_StringHolder NET_HTTPRequest::protocol ( ) const
inline

Definition at line 64 of file NET_HTTPRequest.h.

const UT_StringHolder& NET_HTTPRequest::queryString ( ) const
inline

Definition at line 107 of file NET_HTTPRequest.h.

NET_HTTPStatusCode NET_HTTPRequest::requestStatus ( ) const
inline

Definition at line 169 of file NET_HTTPRequest.h.

void NET_HTTPRequest::resetForRead ( )
protected
static UT_StringHolder NET_HTTPRequest::sanitizePath ( const UT_StringHolder path)
static
void NET_HTTPRequest::setClientIp ( unsigned short  ip[4])
inline

Definition at line 134 of file NET_HTTPRequest.h.

void NET_HTTPRequest::setTimestamp ( const NET_Time t)
inline

Definition at line 160 of file NET_HTTPRequest.h.

const NET_Time& NET_HTTPRequest::timestamp ( ) const
inline

Definition at line 159 of file NET_HTTPRequest.h.

const ReqMap& NET_HTTPRequest::uriVariables ( ) const
inline

Definition at line 164 of file NET_HTTPRequest.h.

const ReqMap& NET_HTTPRequest::variables ( ) const
inline

Definition at line 163 of file NET_HTTPRequest.h.

unsigned NET_HTTPRequest::versionMaj ( ) const
inline

Definition at line 101 of file NET_HTTPRequest.h.

unsigned NET_HTTPRequest::versionMin ( ) const
inline

Definition at line 102 of file NET_HTTPRequest.h.

Friends And Related Function Documentation

friend class NET_HttpIO
friend

Definition at line 212 of file NET_HTTPRequest.h.

Member Data Documentation

NET_WebMap NET_HTTPRequest::myMetaData

Definition at line 199 of file NET_HTTPRequest.h.

int NET_HTTPRequest::myPort

Definition at line 202 of file NET_HTTPRequest.h.

NET_WebStream* NET_HTTPRequest::myStream

Definition at line 203 of file NET_HTTPRequest.h.


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