NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
CCgiRequest Class Reference

Search Toolkit Book for CCgiRequest

CCgiRequest:: More...

#include <cgi/ncbicgi.hpp>

+ Inheritance diagram for CCgiRequest:
+ Collaboration diagram for CCgiRequest:

Public Types

enum  Flags {
  fIndexesNotEntries = (1 << 0) , fIgnoreQueryString = (1 << 1) , fOwnEnvironment = (1 << 2) , fDoNotParseContent = (1 << 3) ,
  fCaseInsensitiveArgs = (1 << 4) , fCookies_Unencoded = (1 << 5) , fCookies_SpaceAsHex = (1 << 6) , fSaveRequestContent = (1 << 7) ,
  fIgnorePageHitId = (1 << 8) , fSkipDiagProperties = (1 << 9) , fSetDiagProperties = 0 , fParseInputOnDemand = (1 << 10) ,
  fSemicolonIsNotArgDelimiter = (1 << 11) , fDisableTrackingCookie = (1 << 12) , fIncludePreparsedEntries = (1 << 13) , fDisableParsingAsIndex = (1 << 14)
}
 
enum  ESessionCreateMode { eCreateIfNotExist , eDontCreateIfNotExist , eDontLoad }
 
enum  ERequestMethod {
  eMethod_GET , eMethod_POST , eMethod_HEAD , eMethod_PUT ,
  eMethod_DELETE , eMethod_OPTIONS , eMethod_TRACE , eMethod_CONNECT ,
  eMethod_Other
}
 Standard request methods. More...
 
typedef int TFlags
 Startup initialization. More...
 

Public Member Functions

 CCgiRequest (const CNcbiArguments *args=0, const CNcbiEnvironment *env=0, CNcbiIstream *istr=0, TFlags flags=0, int ifd=-1, size_t errbuf_size=256)
 
 CCgiRequest (int argc, const char *const *argv, const char *const *envp=0, CNcbiIstream *istr=0, TFlags flags=0, int ifd=-1, size_t errbuf_size=256)
 args := CNcbiArguments(argc,argv), env := CNcbiEnvironment(envp) More...
 
 CCgiRequest (CNcbiIstream &is, TFlags flags=0, size_t errbuf_size=256)
 
 ~CCgiRequest (void)
 Destructor. More...
 
const stringGetProperty (ECgiProp prop) const
 Get value of a "standard" property (return empty string if not defined) More...
 
const stringGetRandomProperty (const string &key, bool http=true) const
 Get value of a random client property; if "http" is TRUE then add prefix "HTTP_" to the property name. More...
 
size_t GetContentLength (void) const
 
const stringGetContent (void) const
 Get request content. More...
 
const CCgiCookiesGetCookies (void) const
 Retrieve the request cookies. More...
 
CCgiCookiesGetCookies (void)
 
const TCgiEntriesGetEntries (void) const
 Get a set of entries(decoded) received from the client. More...
 
TCgiEntriesGetEntries (void)
 
const CCgiEntryGetEntry (const string &name, bool *is_found=0) const
 Get entry value by name. More...
 
TCgiEntriesI GetNextEntry (void)
 Get next entry when parsing input on demand. More...
 
CCgiEntryGetPossiblyUnparsedEntry (const string &name)
 Get entry value by name, calling GetNextEntry() as needed. More...
 
void ParseRemainingContent (void)
 Parse any remaining POST content for use by GetEntries() et al. More...
 
const TCgiIndexesGetIndexes (void) const
 Get a set of indexes(decoded) received from the client. More...
 
TCgiIndexesGetIndexes (void)
 
CCgiSessionGetSession (ESessionCreateMode mode=eCreateIfNotExist) const
 Get session. More...
 
CNcbiIstreamGetInputStream (void) const
 Return pointer to the input stream. More...
 
int GetInputFD (void) const
 Returns file descriptor of input stream, or -1 if unavailable. More...
 
void SetInputStream (CNcbiIstream *is, bool own=false, int fd=-1)
 Set input stream to "is". More...
 
const char *constGetClientTrackingEnv (void) const
 Return client tracking environment variables These variables are stored in the form "name=value". More...
 
void Serialize (CNcbiOstream &os) const
 Serialize/Deserialize a request to/from a stream. More...
 
void Deserialize (CNcbiIstream &is, TFlags flags=0)
 
const CNcbiEnvironmentGetEnvironment () const
 
void GetCGIEntries (CEntryCollector_Base &collector) const
 Get full set of arguments (both GET and POST), URL-encoded. More...
 
string GetCGIEntriesStr (void) const
 Shortcut for collecting arguments into a URL-style string. More...
 
bool CalcChecksum (string &checksum, string &content) const
 
const stringGetRequestMethodName (void) const
 Get request method name. More...
 
ERequestMethod GetRequestMethod (void) const
 Get request method. More...
 
void SetTrackingCookie (const string &cookie_value)
 Store/retrieve tracking cookie value. More...
 
const stringGetTrackingCookie (void) const
 
void x_SetSession (CCgiSession &session)
 

Static Public Member Functions

static const string GetPropertyName (ECgiProp prop)
 Get name (not value!) of a "standard" property. More...
 
static SIZE_TYPE ParseEntries (const string &str, TCgiEntries &entries)
 Decode the URL-encoded(FORM or ISINDEX) string "str" into a set of entries <"name", "value"> and add them to the "entries" set. More...
 
static SIZE_TYPE ParseIndexes (const string &str, TCgiIndexes &indexes)
 Decode the URL-encoded string "str" into a set of ISINDEX-like entries and add them to the "indexes" set. More...
 

Static Public Attributes

static const size_t kContentLengthUnknown = (size_t)(-1)
 Get content length using value of the property 'eCgi_ContentLength'. More...
 

Private Member Functions

void x_Init (const CNcbiArguments *args, const CNcbiEnvironment *env, CNcbiIstream *istr, TFlags flags, int ifd)
 the real constructor code More...
 
const stringx_GetPropertyByName (const string &name) const
 retrieve(and cache) a property of given name More...
 
void x_ProcessQueryString (TFlags flags, const CNcbiArguments *args)
 Parse entries or indexes from "$QUERY_STRING" or cmd.-line args. More...
 
void x_ProcessInputStream (TFlags flags, CNcbiIstream *istr, int ifd)
 Parse input stream if needed. More...
 
void x_SetClientIpProperty (TFlags flags) const
 Set client-ip property for logging. More...
 
void x_InitRequestContext (TFlags flags)
 Set the properties of CRequestContext (HitId, Dtab etc.). More...
 
 CCgiRequest (const CCgiRequest &)
 prohibit default initialization and assignment More...
 
CCgiRequestoperator= (const CCgiRequest &)
 
string x_RetrieveSessionId () const
 

Private Attributes

const CNcbiEnvironmentm_Env
 set of environment variables More...
 
unique_ptr< CNcbiEnvironmentm_OwnEnv
 
unique_ptr< stringm_Content
 Original request content or NULL if fSaveRequestContent is not set. More...
 
TCgiEntries m_Entries
 set of the request FORM-like entries(already retrieved; cached) More...
 
TCgiIndexes m_Indexes
 set of the request ISINDEX-like indexes(already retrieved; cached) More...
 
CCgiCookies m_Cookies
 set of the request cookies(already retrieved; cached) More...
 
CNcbiIstreamm_Input
 input stream More...
 
int m_InputFD
 input file descriptor, if available. More...
 
bool m_OwnInput
 
size_t m_ErrBufSize
 Request initialization error buffer size; when initialization code hits unexpected EOF it will try to add diagnostics and print out accumulated request buffer 0 in this variable means no buffer diagnostics. More...
 
string m_TrackingCookie
 
bool m_QueryStringParsed
 
unique_ptr< CTrackingEnvHolderm_TrackingEnvHolder
 
CCgiSessionm_Session
 
CCgiEntryReaderContextm_EntryReaderContext
 

Detailed Description

CCgiRequest::

The CGI request class

Definition at line 684 of file ncbicgi.hpp.


The documentation for this class was generated from the following files:
Modified on Sun Apr 21 03:42:25 2024 by modify_doxy.py rev. 669887