(TCookieEncoding::GetDefault()) {
130 return "\""+ esc +
"\"";
142return ::memcmp(&date, &
kZeroTime,
sizeof(tm)) == 0 ?
true:
false;
147: m_Name(cookie.m_Name),
148m_Value(cookie.m_Value),
149m_Domain(cookie.m_Domain),
150m_Path(cookie.m_Path),
151m_InvalidFlag(cookie.m_InvalidFlag)
160 const string& domain,
const string& path)
161: m_InvalidFlag(fValid)
163 if( name.empty() ) {
191 if(&cookie ==
this)
212 if( !::strftime(
str,
sizeof(
str),
213 "%a, %d %b %Y %H:%M:%S GMT", &
m_Expires) ) {
215 "CCgiCookie::GetExpDate() -- strftime() failed");
239 "Banned symbol in the cookie's name: " 244 "Banned symbol in the cookie's value (name: "+
m_Name+
"): " 248os <<
"Set-Cookie: ";
257os <<
"; domain="<<
m_Domain.c_str();
259os <<
"; path="<<
m_Path.c_str();
261 if( !x_ExpDate.empty() )
262os <<
"; expires="<< x_ExpDate.c_str();
285 const char* banned_symbols,
286 const string* cookie_name)
288 if( banned_symbols ) {
289string::size_type pos =
str.find_first_of(banned_symbols);
291 string msg=
"Banned symbol '"+
293+
"' in the cookie";
305 msg+=
" (name: '"+ *cookie_name +
"')";
314 for(
const char* s =
str.c_str(); *s; s++) {
315 if( !
isprint((
unsigned char)(*s)) ) {
316 string msg=
"Banned symbol '"+
318+
"' in the cookie";
323 msg+=
" (name: '"+ *cookie_name +
"')";
333(
const string& name1,
const string& domain1,
const string& path1,
334 const string& name2,
const string& domain2,
const string& path2)
339x_less = nocase_less(name1, name2);
340 if(x_less || nocase_less(name2, name1))
343x_less = nocase_less(domain1, domain2);
344 if(x_less || nocase_less(domain2, domain1))
348 return!path2.empty();
351 return(path1.compare(path2) > 0);
384 const string& domain ,
const string& path,
401 switch( on_bad_cookie ) {
422 const string&
value,
455 const char* banned_symbols,
457 const string* cookie_name)
462 switch( on_bad_cookie ) {
495 static bools_BannedSymbolsSet =
false;
496 if( !s_BannedSymbolsSet ) {
497*s_BannedSymbols = TCookieNameBannedSymbols::GetDefault();
498s_BannedSymbolsSet =
true;
500 returns_BannedSymbols.
Get().c_str();
512 boolneed_decode =
true;
514 if(pos_beg ==
NPOS)
517 SIZE_TYPEpos_mid =
str.find_first_of(
"=;,\r\n", pos_beg);
518 if(pos_mid ==
NPOS) {
519 stringname =
str.substr(pos_beg);
521banned_symbols, on_bad_cookie) ) {
538 if(
str[pos_mid] !=
'=') {
539 stringname =
str.substr(pos_beg, pos_mid - pos_beg);
541banned_symbols, on_bad_cookie) ) {
556 if((
str[pos_mid] !=
';'&&
str[pos_mid] !=
',') ||
557++pos_mid ==
str.length())
562 stringname =
str.substr(pos_beg, pos_mid - pos_beg);
563 boolquoted_value =
false;
564 SIZE_TYPEpos_end =
str.find_first_of(
";,", pos_mid);
566 if(pos_mid + 1 <
str.length() &&
str[pos_mid + 1] ==
'"') {
567quoted_value =
true;
571 while(pos_q !=
NPOS&&
str[pos_q - 1] ==
'\\') {
572pos_q =
str.find(
'"', pos_q + 1);
574 boolvalid_quotes = (pos_q !=
NPOS);
577pos_end =
str.find_first_of(
";,", pos_q + 1);
578 size_tval_end = pos_end;
579 if(val_end ==
NPOS) {
580val_end =
str.size();
582 if(val_end > pos_q + 1) {
585 stringextra =
str.substr(pos_q + 1, val_end - pos_q - 1);
586 if(extra.find_first_not_of(
" \t\n") !=
NPOS) {
587valid_quotes =
false;
588 msg=
"Unescaped quote in cookie value (name: "+
595 msg=
"Missing closing quote in cookie value (name: "+
599 if( valid_quotes ) {
600need_decode =
false;
603quoted_value =
false;
605 switch( on_bad_cookie ) {
626 if(pos_end !=
NPOS) {
630pos_end =
str.find_last_not_of(
" \t\n",
str.length());
635 string val=
str.substr(pos_mid + 1, pos_end - pos_mid);
643banned_symbols, on_bad_cookie);
646on_bad_cookie, &name);
676 if(!
m_Secure&& (*cookie)->GetSecure()) {
690(
const string& name,
const string& domain,
const string& path)
695(*iter)->GetPath(), name, domain, path)) {
702(*iter)->GetDomain(), (*iter)->GetPath())) {
705 _ASSERT( path.compare((*iter)->GetPath()) == 0 );
713(
const string& name,
const string& domain,
const string& path)
716 return const_cast<CCgiCookies*
>(
this)->
Find(name, domain, path);
726 while(beg !=
m_Cookies.
end() && nocase_less((*beg)->GetName(), name))
732!nocase_less(name, (*beg)->GetName())) ? *beg : 0;
738!nocase_less(name, (*end)->GetName()))
742 return(beg == end) ? 0 : *beg;
753range->first = x_range.first;
754range->second = x_range.second;
757 returnnonconst_This.
Find(name, 0);
783 for(
TIteriter = range.first; iter != range.second; iter++,
count++) {
805(*cookie)->SetSecure(
value);
814(*cookie)->SetHttpOnly(
value);
843 "HTTP_CAF_PROXIED_HOST",
844 "HTTP_X_FORWARDED_FOR",
846 "HTTP_X_FWD_IP_ADDR",
857: m_Env(
env), m_TrackingEnv(
NULL)
868 for(
const char*
const* name =
kTrackingVars; *name; ++name) {
895 for(
char** ptr =
env; *ptr; ++ptr) {
919 "GATEWAY_INTERFACE",
941 "HTTP_IF_MODIFIED_SINCE",
954 "CCgiRequest::GetPropertyName(BadPropIdx)");
962 const string&
value,
unsigned intposition,
984 const string&
value,
1017m_OwnInput(
false),
1018m_ErrBufSize(errbuf_size),
1019m_QueryStringParsed(
false),
1021m_EntryReaderContext(
NULL)
1029 const char*
const* argv,
1030 const char*
const* envp,
1037(
flags& fCaseInsensitiveArgs) ?
1041m_OwnInput(
false),
1042m_ErrBufSize(errbuf_size),
1043m_QueryStringParsed(
false),
1045m_EntryReaderContext(
NULL)
1065m_OwnInput(
false),
1066m_ErrBufSize(errbuf_size),
1067m_QueryStringParsed(
false),
1069m_EntryReaderContext(
NULL)
1129TOnBadCookieParam::GetDefault());
1132 "Error in parsing HTTP request cookies");
1148 "its value is: '"<< empty_it->second <<
"'. ATTENTION: " 1149 "Because of this, check for image names will be disabled.");
1154 const string& entry =
i->first;
1161 stringname = entry.substr(0, entry.size() - 2);
1166 if( !image_name.empty() ) {
1167 ERR_POST_X(6,
"duplicated IMAGE name: \""<< image_name <<
1168 "\" and \""<< name <<
"\"");
1179 if(forward.
empty()) {
1183vector<CTempStringEx> words;
1186 for(
size_t i= 0;
i< words.size(); ++
i) {
1198 if( forward.
empty() ) {
1202vector<CTempStringEx> words;
1205 if( !words.size() ) {
1210 for(
i= 0;
i< words.size(); ++
i) {
1234 if(
internal|| !external ) {
1252 if( !
client.empty() ) {
1264 if( !pt_data.empty() ) {
1274 while(phid_rg.first != phid_rg.second) {
1275phid = phid_rg.first->second;
1283 if( phid.empty() ) {
1293 if( !dtab.empty() ) {
1298 if(
autoauth_token = TCookieAuthToken::GetDefault(); !auth_token.empty()) {
1300rctx.
SetProperty(
"auth_token", cookie->GetValue());
1312 const string* query_string =
NULL;
1316 if(args && args->
Size() == 2)
1317query_string = &(*args)[1];
1324 if( query_string ) {
1346(content_type.empty() ||
1348 "application/x-www-form-urlencoded") ||
1350 "multipart/form-data"))) {
1352unique_ptr<string> temp_str;
1358}
else if(content_type.empty()
1360temp_str.reset(
new string);
1361pstr = temp_str.get();
1371}
else if(content_type.empty()) {
1397 "Failed read of HTTP request body",
1398(
size_t)istr->gcount());
1420 "Request content is not available");
1456*is_found = x_found;
1458 returnx_found ? it->second : s_EmptyCgiEntry.
Get();
1478}
while(it->first != name);
1497 if(
str.empty() ) {
1501 size_tcontent_length;
1506 "Malformed Content-Length value in HTTP request: "+
str);
1509 returncontent_length;
1578 while(!istrm->eof()) {
1579istrm->read(
buf,
sizeof(
buf));
1580os.write(
buf, istrm->gcount());
1593 if(!is.eof() && is.good()) {
1601 if(!is.eof() && is.good())
1616 "Session implementation error");
1622 "Session doesn't exist.");
1635CGI_LOG_EXCLUDE_ARGS);
1644CGI_LOG_LIMIT_ARGS);
1653 if( idx->empty() ) {
1661list<string> excluded, limited;
1665TArgLimits arg_limits;
1666 intlim_unlisted = -1;
1668 NStr::Split(TCGI_LogLimitArgs::GetDefault(),
"&", limited,
1670 ITERATE(list<string>, it, limited) {
1673 if( arg.empty() ) {
1674 ERR_POST(
Error<<
"Missing argument name before size limit: " 1678 if(
val.empty() ) {
1679 ERR_POST(
Error<<
"Missing argument size limit: "<< *it);
1687 ERR_POST(
Error<<
"Invalid argument size limit: "<< *it);
1691lim_unlisted = ival;
1694arg_limits[arg] = ival;
1697 NStr::Split(TCGI_LogExcludeArgs::GetDefault(),
"&", excluded,
1699 ITERATE(list<string>, it, excluded) {
1703arg_limits[*it] = -2;
1707 if(entry->first.empty() && entry->second.empty()) {
1710TArgLimits::const_iterator lim_it = arg_limits.find(entry->first);
1711 intlim = (lim_it == arg_limits.end()) ? lim_unlisted : lim_it->second;
1717lim >= 0 ? entry->second.substr(0, lim) :
string(entry->second),
1718entry->second.GetFilename(),
1729 virtual void AddEntry(
const string& name,
1730 const string&
value,
1731 const string& filename,
1742 const string&
value,
1747 if( !
m_Args.empty() ) {
1753 if( !
m_Args.empty() ) {
1782content += entry->first +
'='+ entry->second;
1812 const char* s_Request_Method_Names[8] = {
1833 for(
int i= 0;
i< 8;
i++) {
1835 returns_Request_Methods[
i];
1851 return type.substr(pos, pos2 ==
NPOS? pos2 : pos2 - pos);
1858 const char* s_ISO_8859_1_Names[8] = {
1868 for(
int i= 0;
i< 8;
i++) {
1880 const char* s_Windows_1252_Name =
"windows-1252";
1888 const char* s_UTF_8_Name =
"utf-8";
1896 if( charset.empty() ) {
1912 unsigned charu1[2];
1915s_BE_test.u1[0] = 0xFF;
1916s_BE_test.u1[1] = 0xFE;
1917 static bools_BE = (s_BE_test.u2 == 0xFFFE);
1954 const string&
value,
1955 const string& filename,
1960filename.empty() ?
value: filename +
"/"+
value));
Support classes for on-demand CGI input parsing.
Exception classes used by the NCBI CGI framework.
CNcbiIstream & ReadMap(CNcbiIstream &is, TMap &cont)
Read a map from a stream.
CNcbiIstream & ReadEnvironment(CNcbiIstream &is, CNcbiEnvironment &cont)
Write an environment from a stream.
CNcbiIstream & ReadCgiCookies(CNcbiIstream &is, CCgiCookies &cont)
Read cgi cookeis from a stream.
CNcbiOstream & WriteContainer(CNcbiOstream &os, const TCont &cont)
Write a container to a stream.
CNcbiOstream & WriteEnvironment(CNcbiOstream &os, const CNcbiEnvironment &cont)
Write an environment to a stream.
CNcbiOstream & WriteMap(CNcbiOstream &os, const TMap &cont)
Write a map to a stream.
CNcbiOstream & WriteCgiCookies(CNcbiOstream &os, const CCgiCookies &cont)
Write cgi cookeis to a stream.
CNcbiIstream & ReadContainer(CNcbiIstream &is, TCont &cont)
Read a container from a stream.
API to store CGI session data between Web requests.
Checksum and hash calculation classes.
virtual void AddArgument(unsigned int position, const string &name, const string &value, EArgType arg_type)
Process next query argument.
CCgiEntries_Parser(TCgiEntries *entries, TCgiIndexes *indexes, CCgiRequest::TFlags flags)
static CCgiRequest::TFlags TFlagsToCCgiRequestTFlags(TFlags flags)
CCgiRequestException â.
CCgiSessionException â.
CChecksum â Checksum calculator.
static CNcbiApplication * Instance(void)
Singleton method.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Request context properties passed between tasks.
T & Get(void)
Create the variable if not created yet, return the reference.
CStringEntryCollector(void)
virtual void AddEntry(const string &name, const string &value, const string &filename, bool is_index)
const string & GetArgs(void) const
virtual ~CStringEntryCollector(void)
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
CTrackingEnvHolder(const CNcbiEnvironment *env)
const char *const * GetTrackingEnv(void) const
const CNcbiEnvironment * m_Env
Define Case-insensitive string comparison methods.
const_iterator_pair equal_range(const key_type &key) const
container_type::const_iterator const_iterator
const_iterator find(const key_type &key) const
const_iterator end() const
iterator insert(const value_type &val)
container_type::value_type value_type
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator end() const
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const string & GetProgramDisplayName(void) const
Get the application's "display" name.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
@ eSessionId
SessionId not specified.
const CNcbiEnvironment * m_Env
set of environment variables
const TCgiIndexes & GetIndexes(void) const
Get a set of indexes(decoded) received from the client.
void x_ProcessQueryString(TFlags flags, const CNcbiArguments *args)
Parse entries or indexes from "$QUERY_STRING" or cmd.-line args.
pair< TCIter, TCIter > TCRange
TCgiEntries::iterator TCgiEntriesI
TCgiEntries::const_iterator TCgiEntriesCI
string GetExpDate(void) const
Day, dd-Mon-yyyy hh:mm:ss GMT (return empty string if not set)
bool CalcChecksum(string &checksum, string &content) const
static ECheckResult x_CheckField(const string &str, CCgiCookie::EFieldType ftype, const char *banned_symbols, EOnBadCookie on_bad_cookie, const string *cookie_name=NULL)
const string & x_GetPropertyByName(const string &name) const
retrieve(and cache) a property of given name
int m_InputFD
input file descriptor, if available.
const TCgiEntries & GetEntries(void) const
Get a set of entries(decoded) received from the client.
NStr::EUrlEncode m_EncodeFlag
static string x_EncodeCookie(const string &str, EFieldType ftype, NStr::EUrlEncode flag)
static SIZE_TYPE ParseEntries(const string &str, TCgiEntries &entries)
Decode the URL-encoded(FORM or ISINDEX) string "str" into a set of entries <"name",...
void SetPath(const string &str)
void x_InitRequestContext(TFlags flags)
Set the properties of CRequestContext (HitId, Dtab etc.).
void ParseRemainingContent(void)
Parse any remaining POST content for use by GetEntries() et al.
void SetValue(const string &str)
All SetXXX(const string&) methods beneath:
const string & GetName(void) const
The cookie name cannot be changed during its whole timelife.
CCgiCookie * Find(const string &name, const string &domain, const string &path)
Return NULL if cannot find this exact cookie.
CCgiEntryReaderContext * m_EntryReaderContext
void AddEntry(const string &name, const string &value, const string &filename, bool is_index) override
void Reset(void)
Reset everything but name to default state like CCgiCookie(m_Name, "")
void Serialize(CNcbiOstream &os) const
Serialize/Deserialize a request to/from a stream.
EWriteMethod
Whether the cookie is sent as a part of HTTP request or HTTP response.
TCgiIndexes m_Indexes
set of the request ISINDEX-like indexes(already retrieved; cached)
void IncludePreparsedEntries(void)
TSet::const_iterator TCIter
void SetUrlEncodeFlag(EUrlEncode encode_flag)
void GetCGIEntries(CEntryCollector_Base &collector) const
Get full set of arguments (both GET and POST), URL-encoded.
pair< TIter, TIter > TRange
const string & GetValue() const
Get the value as a string, (necessarily) prefetching it all if applicable; the result remains availab...
void SetAllCookiesSecure(bool value)
Mark all cookies as secure.
void x_ProcessInputStream(TFlags flags, CNcbiIstream *istr, int ifd)
Parse input stream if needed.
TCgiEntriesI GetNextEntry(void)
void SetExpTime(const CTime &exp_time)
ECgiProp
Set of "standard" HTTP request properties.
CDiagContext_Extra::TExtraArgs m_Args
const CCgiCookies & GetCookies(void) const
Retrieve the request cookies.
CNcbiIstream * m_Input
input stream
const char *const * GetClientTrackingEnv(void) const
Return client tracking environment variables These variables are stored in the form "name=value".
void CopyAttributes(const CCgiCookie &cookie)
Set all attribute values(but name!) to those from "cookie".
const string & GetContentType() const
May be available for some fields of POSTed forms.
string GetCGIEntriesStr(void) const
Shortcut for collecting arguments into a URL-style string.
CNcbiOstream & Write(CNcbiOstream &os, EWriteMethod wmethod=eHTTPResponse, EUrlEncode flag=eUrlEncode_SkipMarkChars) const
Compose and write to output stream "os":
bool Remove(CCgiCookie *cookie, bool destroy=true)
Remove "cookie" from this set; deallocate it if "destroy" is true Return FALSE if can not find "cooki...
CCgiEntry * GetPossiblyUnparsedEntry(const string &name)
Get entry value by name, calling GetNextEntry() as needed.
TCgiEntries m_Entries
set of the request FORM-like entries(already retrieved; cached)
const string & GetProperty(ECgiProp prop) const
Get value of a "standard" property (return empty string if not defined)
list< string > TCgiIndexes
void Clear(void)
Remove all stored cookies.
CNcbiOstream & Write(CNcbiOstream &os, CCgiCookie::EWriteMethod wmethod=CCgiCookie::eHTTPResponse) const
Printout all cookies into the stream "os".
CCgiCookie(const CCgiCookie &cookie)
Copy constructor.
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" ...
void ResetInvalid(TInvalidFlag flag)
unique_ptr< CTrackingEnvHolder > m_TrackingEnvHolder
void x_Init(const CNcbiArguments *args, const CNcbiEnvironment *env, CNcbiIstream *istr, TFlags flags, int ifd)
the real constructor code
CCgiCookie * Add(const string &name, const string &value, const string &domain=kEmptyStr, const string &path=kEmptyStr, EOnBadCookie on_bad_cookie=eOnBadCookie_SkipAndError)
All Add() functions: if the added cookie has the same {name, domain, path} as an already existing one...
unique_ptr< CNcbiEnvironment > m_OwnEnv
TCRange GetAll(void) const
Return the full range [begin():end()] on the underlying container.
string x_GetCharset(void) const
TCgiEntriesI GetNextEntry(void)
Get next entry when parsing input on demand.
void SetInputStream(CNcbiIstream *is, bool own=false, int fd=-1)
Set input stream to "is".
virtual void AddEntry(const string &name, const string &value, const string &filename, bool is_index=false)=0
CCgiCookies m_Cookies
set of the request cookies(already retrieved; cached)
const string & GetContent(void) const
Get request content.
void SetAllCookiesHttpOnly(bool value)
Mark all cookies as HTTP_ONLY.
const string & GetPath(void) const
unique_ptr< string > m_Content
Original request content or NULL if fSaveRequestContent is not set.
EOnBadCookie
How to handle badly formed cookies.
static const size_t kContentLengthUnknown
Get content length using value of the property 'eCgi_ContentLength'.
~CCgiRequest(void)
Destructor.
TInvalidFlag m_InvalidFlag
void SetInvalid(TInvalidFlag flag)
const string & GetRandomProperty(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...
CCgiSession & GetSession(ESessionCreateMode mode=eCreateIfNotExist) const
Get session.
void Deserialize(CNcbiIstream &is, TFlags flags=0)
bool operator<(const CCgiCookie &cookie) const
Compare two cookies.
TInvalidFlag IsInvalid(void) const
CStringUTF8 GetValueAsUTF8(EOnCharsetError on_error=eCharsetError_Ignore) const
static void x_CheckField(const string &str, EFieldType ftype, const char *banned_symbols, const string *cookie_name=NULL)
const CCgiEntry & GetEntry(const string &name, bool *is_found=0) const
Get entry value by name.
ERequestMethod
Standard request methods.
int TFlags
Startup initialization.
static const string GetPropertyName(ECgiProp prop)
Get name (not value!) of a "standard" property.
void x_SetClientIpProperty(TFlags flags) const
Set client-ip property for logging.
size_t GetContentLength(void) const
CNcbiIstream * GetInputStream(void) const
Return pointer to the input stream.
const string & GetDomain(void) const
const string & GetRequestMethodName(void) const
Get request method name.
void SetDomain(const string &str)
EOnCharsetError
Action to perform if the explicit charset is not supported.
CCgiRequest(const CNcbiArguments *args=0, const CNcbiEnvironment *env=0, CNcbiIstream *istr=0, TFlags flags=0, int ifd=-1, size_t errbuf_size=256)
ERequestMethod GetRequestMethod(void) const
Get request method.
@ fIgnorePageHitId
Do not check if page hit id is present, do not generate one if it's missing.
@ fIndexesNotEntries
do not handle indexes as regular FORM entries with empty value
@ fOwnEnvironment
own the passed "env" (and destroy it in the destructor)
@ fCookies_SpaceAsHex
Use hex code for encoding spaces rather than '+'.
@ fSaveRequestContent
Save request content (available through GetContent())
@ fCookies_Unencoded
Do not use URL-encoding/decoding for cookies.
@ fIncludePreparsedEntries
When parsing input on demand iterate all existing entries (e.g.
@ fDoNotParseContent
do not automatically parse the request's content body (from "istr")
@ fParseInputOnDemand
Enable on-demand parsing via GetNextEntry()
@ fIgnoreQueryString
do not parse $QUERY_STRING (or cmd.line if $REQUEST_METHOD not def)
@ fSkipDiagProperties
Set client-ip and session-id properties for logging.
@ eOnBadCookie_StoreAndError
Report error, store bad cookie as-is.
@ eOnBadCookie_ThrowException
Throw exception, ignore bad cookie.
@ eOnBadCookie_Store
Store bad cookie without URL-decoding.
@ eOnBadCookie_SkipAndError
Report error, ignore bad cookie.
@ eOnBadCookie_Skip
Silently ignore bad cookie.
@ eCreateIfNotExist
If Session does not exist the new one will be created.
@ eMethod_Other
Unknown method, use GetRequestMethodName to read.
@ eCharsetError_Throw
Throw exception if charset is not supported.
bool Exists(void) const
Check if this session object is valid.
void CreateNewSession(void)
Create new session.
void Load(void)
Load the session.
void AddLine(const char *line, size_t len)
CNcbiOstream & WriteChecksumData(CNcbiOstream &out) const
static string SelectLastHitID(const string &hit_ids)
Select the last hit id from the list of ids separated with commas and optional spaces.
void SetDtab(const string &dtab)
void SetClientIP(const string &client)
void SetProperty(const string &name, const string &value)
Add/change property.
static CRequestContext & GetRequestContext(void)
Shortcut to CDiagContextThreadData::GetThreadData().GetRequestContext()
bool IsSetHitID(EHitIDSource src=eHitID_Any) const
Check if there's an explicit hit id or the default one.
void Deserialize(CTempString data, EFormat format)
Deserialize values using the specified format.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
bool IsSetProperty(const string &name) const
Check if the property has a value (even if it's an empty string).
bool IsSetDtab(void) const
Dtab.
void SetHitID(const string &hit)
Set explicit hit id. The id is reset on request end.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
EDiagSev
Severity level for the posted diagnostics.
SDiagMessage::TExtraArg TExtraArg
@ eHitID_Request
Check if per-request hit id is set.
@ eFormat_UrlEncoded
name=value pairs URL-encoded and separated with '&'
@ eDiag_Trace
Trace message.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
const string & Get(const string &name, bool *found=NULL) const
Get environment value by name.
SIZE_TYPE Size(void) const
Get size (number) of arguments.
void Error(CExceptionArgs_Base &args)
#define NCBI_CATCH_ALL_X(err_subcode, message)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
#define NCBI_THROW2(exception_class, err_code, message, extra)
Throw exception with extra parameter.
#define NCBI_RETHROW(prev_exception, exception_class, err_code, message)
Generic macro to re-throw an exception.
@ eParam_NoThread
Do not use per-thread values.
uint16_t Uint2
2-byte (16-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
EEncodingForm
Helper functions to read plain-text data streams.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static void Pushback(CNcbiIstream &is, CT_CHAR_TYPE *buf, streamsize buf_size, void *del_ptr)
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
EEncodingForm ReadIntoUtf8(CNcbiIstream &input, CStringUTF8 *result, EEncodingForm encoding_form=eEncodingForm_Unknown, EReadUnknownNoBOM what_if_no_bom=eNoBOM_GuessEncoding)
Read all input data from stream and try convert it into UTF8 string.
bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)
Copy the entire contents of stream "is" to stream "os".
@ eEncodingForm_Utf16Foreign
Stream has UTF16 BOM. Byte order is nonnative for this OS.
@ eEncodingForm_Utf8
Stream has UTF8 BOM.
@ eEncodingForm_ISO8859_1
Stream has no BOM.
@ eEncodingForm_Windows_1252
Stream has no BOM.
@ eEncodingForm_Unknown
Stream has no BOM.
@ eEncodingForm_Utf16Native
Stream has UTF16 BOM. Byte order is native for this OS.
NCBI_NS_STD::string::size_type SIZE_TYPE
static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)
Get a printable version of the specified string.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
EUrlEncode
URL-encode flags.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
EUrlDecode
URL decode flags.
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
const char * g_GetNcbiString(ENcbiStrings what)
static string URLDecode(const CTempString str, EUrlDecode flag=eUrlDec_All)
URL-decode string.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
string::size_type GetPos(void) const noexcept
Get error position.
PNocase_Generic< string > PNocase
bool empty(void) const
Return true if the represented string is empty (i.e., the length is zero)
bool AStrEquiv(const Arg1 &x, const Arg2 &y, Pred pr)
Check equivalence of arguments using predicate.
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static bool NeedsURLEncoding(const CTempString str, EUrlEncode flag=eUrlEnc_SkipMarkChars)
Check if the string needs the requested URL-encoding.
static bool IsIPAddress(const CTempStringEx str)
Check if the string contains a valid IP address.
static string URLEncode(const CTempString str, EUrlEncode flag=eUrlEnc_SkipMarkChars)
URL-encode string.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
@ eUrlEnc_URIQueryValue
Encode query part of an URI, arg value.
@ eUrlEnc_PercentOnly
Convert all non-alphanumeric chars including space and '' to %## format.
@ eUrlEnc_URIQueryName
Encode query part of an URI, arg name.
@ eUrlEnc_SkipMarkChars
Do not convert chars like '!', '(' etc.
@ eUrlEnc_Cookie
Same as SkipMarkChars with encoded ','.
@ eUrlDec_All
Decode '+' to space.
@ eUrlDec_Percent
Decode only XX.
@ eTrunc_End
Truncate trailing whitespace only.
int Minute(void) const
Get minute.
int DayOfWeek(void) const
Get day of week.
bool IsGmtTime(void) const
int Year(void) const
Get year.
int Day(void) const
Get day.
int Hour(void) const
Get hour.
int Second(void) const
Get second.
int Month(void) const
Get month.
void SetQueryString(const string &query, NStr::EUrlEncode encode)
Parse query string, call AddArgument() to store each value.
EArgType
Query type flag.
@ eArg_Value
Query contains name=value pairs.
unsigned int
A callback function used to compare two keys in a database.
Definition of all error codes used in cgi (xcgi.lib).
if(yy_accept[yy_current_state])
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Static variables safety - create on demand, destroy on application termination.
String constants used in NCBI C/C++ toolkit.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
static const char * s_PropName[eCgi_NProperties+1]
bool s_Is_UTF_8(const string &charset)
static const char * kTrackingVars[]
NCBI_PARAM_DECL(string, CGI, cookie_auth_token)
bool s_Is_Windows_1252(const string &charset)
NCBI_PARAM_DEF_EX(string, CGI, Cookie_Name_Banned_Symbols, " ,;=", eParam_NoThread, CGI_COOKIE_NAME_BANNED_SYMBOLS)
static void s_AddEntry(TCgiEntries &entries, const string &name, const string &value, unsigned int position, const string &filename=kEmptyStr, const string &type=kEmptyStr)
NCBI_PARAM_DEF(string, CGI, cookie_auth_token, "WebCubbyUser")
bool s_IsZeroTime(const tm &date)
EEncodingForm GetCharsetEncodingForm(const string &charset, CCgiEntry::EOnCharsetError on_error)
NCBI_PARAM_ENUM_ARRAY(EDiagSev, CGI, Cookie_Error_Severity)
typedef NCBI_PARAM_TYPE(CGI, Cookie_Error_Severity) TCookieErrorSeverity
static bool s_CookieLess(const string &name1, const string &domain1, const string &path1, const string &name2, const string &domain2, const string &path2)
bool s_Is_ISO_8859_1(const string &charset)
NCBI_PARAM_ENUM_DEF_EX(EDiagSev, CGI, Cookie_Error_Severity, eDiag_Error, eParam_NoThread, CGI_COOKIE_ERROR_SEVERITY)
const char * s_GetCookieNameBannedSymbols(void)
static const tm kZeroTime
NCBI_PARAM_ENUM_DECL(EDiagSev, CGI, Cookie_Error_Severity)
static CTempString x_FirstWord(const CTempStringEx &forward)
Defines unified interface to application:
Defines: CTimeFormat - storage class for time format.
Defines CRequestContext class for NCBI C++ diagnostic API.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static CNamedPipeClient * client
static wxAcceleratorEntry entries[3]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4