NCBI C++ ToolKit
Classes | Macros | Typedefs | Enumerations | Functions | Variables
CGI Request/Response APIs
+ Collaboration diagram for CGI Request/Response APIs:

Classes

class  CCgiEntryReader
 
class  CCgiEntryReaderContext
 
class  CCgiCookie
 CCgiCookie:: More...
 
struct  CCgiCookie::PLessCPtr
 
class  CCgiCookies
 CCgiCookies:: More...
 
class  CCgiEntry
 
struct  CCgiEntry::SData
 
class  CEntryCollector_Base
 
class  CExtraEntryCollector
 
class  CCgiRequest
 CCgiRequest:: More...
 
class  CCgiResponse
 
class  CRefArgs
 CRefArgs:: More...
 

Macros

#define HTTP_EOL   "\r\n"
 

Typedefs

typedef map< string, stringTCgiProperties
 
typedef multimap< string, CCgiEntry, PNocase_ConditionalTCgiEntries
 
typedef TCgiEntries::iterator TCgiEntriesI
 
typedef TCgiEntries::const_iterator TCgiEntriesCI
 
typedef list< stringTCgiIndexes
 
typedef multimap< string, stringCRefArgs::THostMap
 

Enumerations

enum  CCgiEntryReader::EState {
  CCgiEntryReader::fUnread = 0x1, CCgiEntryReader::fHitCR = 0x2, CCgiEntryReader::fHitLF = 0x4, CCgiEntryReader::fHitCRLF = fHitCR | fHitLF,
  CCgiEntryReader::fHitBoundary = 0x8
}
 
enum  CCgiEntryReaderContext::EContentType { CCgiEntryReaderContext::eCT_Null, CCgiEntryReaderContext::eCT_URLEncoded, CCgiEntryReaderContext::eCT_Multipart }
 
enum  CCgiEntryReaderContext::EReadTerminator { CCgiEntryReaderContext::eRT_Delimiter, CCgiEntryReaderContext::eRT_EOF, CCgiEntryReaderContext::eRT_LengthBound, CCgiEntryReaderContext::eRT_PartialDelimiter }
 
enum  CCgiCookie::EWriteMethod { CCgiCookie::eHTTPResponse, CCgiCookie::eHTTPRequest }
 Whether the cookie is sent as a part of HTTP request or HTTP response. More...
 
enum  CCgiCookie::EInvalidFlag { CCgiCookie::fValid = 0, CCgiCookie::fInvalid_Name = 1<<0, CCgiCookie::fInvalid_Value = 1<<1, CCgiCookie::fInvalid_Any = fInvalid_Name | fInvalid_Value }
 
enum  CCgiCookie::EFieldType { CCgiCookie::eField_Name, CCgiCookie::eField_Value, CCgiCookie::eField_Other }
 
enum  CCgiCookie::ECookieEncoding { CCgiCookie::eCookieEnc_Url, CCgiCookie::eCookieEnc_Quote }
 
enum  CCgiCookies::EOnBadCookie {
  CCgiCookies::eOnBadCookie_ThrowException, CCgiCookies::eOnBadCookie_SkipAndError, CCgiCookies::eOnBadCookie_Skip, CCgiCookies::eOnBadCookie_StoreAndError,
  CCgiCookies::eOnBadCookie_Store
}
 How to handle badly formed cookies. More...
 
enum  CCgiCookies::ECheckResult { CCgiCookies::eCheck_Valid, CCgiCookies::eCheck_SkipInvalid, CCgiCookies::eCheck_StoreInvalid }
 
enum  ECgiProp {
  eCgi_ServerSoftware = 0, eCgi_ServerName, eCgi_GatewayInterface, eCgi_ServerProtocol,
  eCgi_ServerPort, eCgi_RemoteHost, eCgi_RemoteAddr, eCgi_ContentType,
  eCgi_ContentLength, eCgi_RequestMethod, eCgi_PathInfo, eCgi_PathTranslated,
  eCgi_ScriptName, eCgi_QueryString, eCgi_AuthType, eCgi_RemoteUser,
  eCgi_RemoteIdent, eCgi_HttpAccept, eCgi_HttpCookie, eCgi_HttpIfModifiedSince,
  eCgi_HttpReferer, eCgi_HttpUserAgent, eCgi_NProperties
}
 Set of "standard" HTTP request properties. More...
 
enum  CCgiEntry::EOnCharsetError { CCgiEntry::eCharsetError_Ignore, CCgiEntry::eCharsetError_Throw }
 Action to perform if the explicit charset is not supported. More...
 
enum  CCgiRequest::Flags {
  CCgiRequest::fIndexesNotEntries = (1 << 0), CCgiRequest::fIgnoreQueryString = (1 << 1), CCgiRequest::fOwnEnvironment = (1 << 2), CCgiRequest::fDoNotParseContent = (1 << 3),
  CCgiRequest::fCaseInsensitiveArgs = (1 << 4), CCgiRequest::fCookies_Unencoded = (1 << 5), CCgiRequest::fCookies_SpaceAsHex = (1 << 6), CCgiRequest::fSaveRequestContent = (1 << 7),
  CCgiRequest::fIgnorePageHitId = (1 << 8), CCgiRequest::fSkipDiagProperties = (1 << 9), CCgiRequest::fSetDiagProperties = 0, CCgiRequest::fParseInputOnDemand = (1 << 10),
  CCgiRequest::fSemicolonIsNotArgDelimiter = (1 << 11), CCgiRequest::fDisableTrackingCookie = (1 << 12)
}
 
enum  CCgiRequest::ESessionCreateMode { CCgiRequest::eCreateIfNotExist, CCgiRequest::eDontCreateIfNotExist, CCgiRequest::eDontLoad }
 
enum  CCgiRequest::ERequestMethod {
  CCgiRequest::eMethod_GET, CCgiRequest::eMethod_POST, CCgiRequest::eMethod_HEAD, CCgiRequest::eMethod_PUT,
  CCgiRequest::eMethod_DELETE, CCgiRequest::eMethod_OPTIONS, CCgiRequest::eMethod_TRACE, CCgiRequest::eMethod_CONNECT,
  CCgiRequest::eMethod_Other
}
 Standard request methods. More...
 
enum  CCgiResponse::EMultipartMode { CCgiResponse::eMultipart_none, CCgiResponse::eMultipart_mixed, CCgiResponse::eMultipart_related, CCgiResponse::eMultipart_replace }
 

Functions

 CRefArgs::CRefArgs (const string &definitions=kEmptyStr)
 Create referrer parser from a set of definitions. More...
 
 CRefArgs::~CRefArgs (void)
 
void CRefArgs::AddDefinitions (const string &definitions)
 Add mappings between host mask and CGI argument name for query string. More...
 
void CRefArgs::AddDefinitions (const string &host_mask, const string &arg_names)
 
string CRefArgs::GetQueryString (const string &referrer) const
 Find query string in the referrer. More...
 
static string CRefArgs::GetDefaultDefinitions (void)
 Get default set of search engine definitions. More...
 
bool CRefArgs::IsListedHost (const string &referrer) const
 Check if the host from the referrer string is listed in definitions. More...
 

Variables

 NCBI_XCGI_EXPORT
 Parameter to control error handling of incoming cookies. More...
 
 CGI
 
 On_Bad_Cookie
 
THostMap CRefArgs::m_HostMap
 

Detailed Description

Macro Definition Documentation

#define HTTP_EOL   "\r\n"

Typedef Documentation

Definition at line 630 of file ncbicgi.hpp.

Definition at line 632 of file ncbicgi.hpp.

Definition at line 631 of file ncbicgi.hpp.

typedef list<string> TCgiIndexes

Definition at line 633 of file ncbicgi.hpp.

Definition at line 629 of file ncbicgi.hpp.

Definition at line 86 of file ref_args.hpp.

Enumeration Type Documentation

enum ECgiProp

Set of "standard" HTTP request properties.

See also
CCgiRequest
Enumerator
eCgi_ServerSoftware 
eCgi_ServerName 
eCgi_GatewayInterface 
eCgi_ServerProtocol 
eCgi_ServerPort 
eCgi_RemoteHost 
eCgi_RemoteAddr 
eCgi_ContentType 
eCgi_ContentLength 
eCgi_RequestMethod 
eCgi_PathInfo 
eCgi_PathTranslated 
eCgi_ScriptName 
eCgi_QueryString 
eCgi_AuthType 
eCgi_RemoteUser 
eCgi_RemoteIdent 
eCgi_HttpAccept 
eCgi_HttpCookie 
eCgi_HttpIfModifiedSince 
eCgi_HttpReferer 
eCgi_HttpUserAgent 
eCgi_NProperties 

Definition at line 370 of file ncbicgi.hpp.

Enumerator
eCheck_Valid 
eCheck_SkipInvalid 
eCheck_StoreInvalid 

Definition at line 325 of file ncbicgi.hpp.

Enumerator
eCT_Null 
eCT_URLEncoded 
eCT_Multipart 

Definition at line 98 of file cgi_entry_reader.hpp.

Enumerator
eCookieEnc_Url 
eCookieEnc_Quote 

Definition at line 187 of file ncbicgi.hpp.

enum CCgiCookie::EFieldType
private
Enumerator
eField_Name 
eField_Value 
eField_Other 

Definition at line 167 of file ncbicgi.hpp.

Enumerator
fValid 
fInvalid_Name 
fInvalid_Value 
fInvalid_Any 

Definition at line 145 of file ncbicgi.hpp.

Enumerator
eMultipart_none 
eMultipart_mixed 
eMultipart_related 
eMultipart_replace 

Definition at line 98 of file ncbicgir.hpp.

How to handle badly formed cookies.

Enumerator
eOnBadCookie_ThrowException 

Throw exception, ignore bad cookie.

eOnBadCookie_SkipAndError 

Report error, ignore bad cookie.

eOnBadCookie_Skip 

Silently ignore bad cookie.

eOnBadCookie_StoreAndError 

Report error, store bad cookie as-is.

eOnBadCookie_Store 

Store bad cookie without URL-decoding.

Definition at line 230 of file ncbicgi.hpp.

Action to perform if the explicit charset is not supported.

Enumerator
eCharsetError_Ignore 

Ignore unknown charset (try to autodetect)

eCharsetError_Throw 

Throw exception if charset is not supported.

Definition at line 491 of file ncbicgi.hpp.

Enumerator
eRT_Delimiter 
eRT_EOF 
eRT_LengthBound 
eRT_PartialDelimiter 

Definition at line 103 of file cgi_entry_reader.hpp.

Standard request methods.

Enumerator
eMethod_GET 
eMethod_POST 
eMethod_HEAD 
eMethod_PUT 
eMethod_DELETE 
eMethod_OPTIONS 
eMethod_TRACE 
eMethod_CONNECT 
eMethod_Other 

Unknown method, use GetRequestMethodName to read.

Definition at line 891 of file ncbicgi.hpp.

Enumerator
eCreateIfNotExist 

If Session does not exist the new one will be created.

eDontCreateIfNotExist 

If Session does not exist the exception will be thrown.

Do not try to load or create session

eDontLoad 

Definition at line 821 of file ncbicgi.hpp.

Enumerator
fUnread 
fHitCR 
fHitLF 
fHitCRLF 
fHitBoundary 

Definition at line 58 of file cgi_entry_reader.hpp.

Whether the cookie is sent as a part of HTTP request or HTTP response.

Enumerator
eHTTPResponse 
eHTTPRequest 

Definition at line 87 of file ncbicgi.hpp.

Enumerator
fIndexesNotEntries 

do not handle indexes as regular FORM entries with empty value

fIgnoreQueryString 

do not parse $QUERY_STRING (or cmd.line if $REQUEST_METHOD not def)

fOwnEnvironment 

own the passed "env" (and destroy it in the destructor)

fDoNotParseContent 

do not automatically parse the request's content body (from "istr")

fCaseInsensitiveArgs 

use case insensitive CGI arguments

fCookies_Unencoded 

Do not use URL-encoding/decoding for cookies.

fCookies_SpaceAsHex 

Use hex code for encoding spaces rather than '+'.

fSaveRequestContent 

Save request content (available through GetContent())

fIgnorePageHitId 

Do not check if page hit id is present, do not generate one if it's missing.

fSkipDiagProperties 

Set client-ip and session-id properties for logging.

fSetDiagProperties 

Old (deprecated) flag controlling diag properties.

fParseInputOnDemand 

Enable on-demand parsing via GetNextEntry()

fSemicolonIsNotArgDelimiter 

Do not treat semicolon as query string argument separator.

fDisableTrackingCookie 

Do not set outgoing tracking cookie.

This can also be done per-request using CCgiResponce::DisableTrackingCookie().

Definition at line 696 of file ncbicgi.hpp.

Function Documentation

void CRefArgs::AddDefinitions ( const string definitions)

Add mappings between host mask and CGI argument name for query string.

See also
CRefArgs::CRefArgs

Definition at line 72 of file ref_args.cpp.

References NStr::fSplit_MergeDelimiters, NStr::fSplit_Truncate, ITERATE, NStr::Split(), and NStr::SplitInTwo().

Referenced by CRefArgs::CRefArgs().

void CRefArgs::AddDefinitions ( const string host_mask,
const string arg_names 
)
CRefArgs::CRefArgs ( const string definitions = kEmptyStr)

Create referrer parser from a set of definitions.

Parameters
definitionsMultiple definitions should be separated by new line ('
'). Host mask should be followed by space(s). Multiple argument names should be separated with commas. E.g. ".google. q, query\n.foo. bar".

Definition at line 60 of file ref_args.cpp.

References CRefArgs::AddDefinitions().

string CRefArgs::GetDefaultDefinitions ( void  )
static

Get default set of search engine definitions.

Definition at line 45 of file ref_args.cpp.

string CRefArgs::GetQueryString ( const string referrer) const

Find query string in the referrer.

Parameters
referrerFull HTTP referrer
Returns
Query string assigned to one of the names associated with the host in the referrer or empty string.

Definition at line 101 of file ref_args.cpp.

References ERR_POST_X, NStr::FindNoCase(), CUrl::GetArgs(), CUrl::GetHost(), CUrlArgs::GetValue(), CUrl::HaveArgs(), CUrlArgs::IsSetValue(), ITERATE, kEmptyStr, CRefArgs::m_HostMap, NPOS, and Warning().

bool CRefArgs::IsListedHost ( const string referrer) const

Check if the host from the referrer string is listed in definitions.

Definition at line 120 of file ref_args.cpp.

References NStr::Find(), NStr::FindNoCase(), ITERATE, CRefArgs::m_HostMap, and NPOS.

CRefArgs::~CRefArgs ( void  )

Definition at line 66 of file ref_args.cpp.

Variable Documentation

CGI

Definition at line 349 of file ncbicgi.hpp.

THostMap CRefArgs::m_HostMap
private
NCBI_XCGI_EXPORT

Parameter to control error handling of incoming cookies.

Does not affect error handling of outgoing cookies set by the application.

Definition at line 349 of file ncbicgi.hpp.

On_Bad_Cookie

Definition at line 349 of file ncbicgi.hpp.

Modified on Tue Jan 16 15:39:44 2018 by modify_doxy.py rev. 546573