bes
Updated for version 3.20.6
|
Classes | |
struct | url |
Static Public Member Functions | |
MIME utility functions | |
These functions are used to create the MIME headers for a message from a server to a client. NB: These functions actually write both the response status line and the header.
| |
static void | set_mime_text (std::ostream &strm) |
Generate an HTTP 1.0 response header for a text document. More... | |
static void | set_mime_html (std::ostream &strm) |
Generate an HTTP 1.0 response header for a html document. More... | |
static std::string | www2id (const std::string &in, const std::string &escape="%", const std::string &except="") |
static std::string | unhexstring (std::string s) |
static std::string | lowercase (const std::string &s) |
static std::string | unescape (const std::string &s) |
static void | check_path (const std::string &path, const std::string &root, bool follow_sym_links) |
Check if the specified path is valid. More... | |
static char * | fastpidconverter (char *buf, int base) |
static char * | fastpidconverter (long val, char *buf, int base) |
static void | removeLeadingAndTrailingBlanks (std::string &key) |
static std::string | id2xml (std::string in, const std::string ¬_allowed="><&'\"") |
static std::string | xml2id (std::string in) |
static void | explode (char delim, const std::string &str, std::list< std::string > &values) |
static std::string | implode (const std::list< std::string > &values, char delim) |
static void | url_explode (const std::string &url_str, BESUtil::url &url_parts) |
Given a url, break the url into its different parts. More... | |
static std::string | url_create (BESUtil::url &url_parts) |
static std::string | assemblePath (const std::string &firstPart, const std::string &secondPart, bool leadingSlash=false, bool trailingSlash=false) |
Assemble path fragments making sure that they are separated by a single '/' character. More... | |
static std::string | pathConcat (const std::string &firstPart, const std::string &secondPart, char separator='/') |
Concatenate path fragments making sure that they are separated by a single '/' character. More... | |
static bool | endsWith (std::string const &fullString, std::string const &ending) |
static void | conditional_timeout_cancel () |
static void | replace_all (std::string &s, std::string find_this, std::string replace_with_this) |
Operates on the string 's' to replaces every occurrence of the value of the string 'find_this' with the value of the string 'replace_with_this'. More... | |
static std::string | normalize_path (const std::string &path, bool leading_separator, bool trailing_separator, const std::string separator="/") |
Removes duplicate separators and provides leading and trailing separators as directed. More... | |
static void | tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters="/") |
static std::string | get_time (bool use_local_time=false) |
static std::string | get_time (time_t the_time, bool use_local_time=false) |
Returns the time represented by 'the_time' as an ISO8601 string. More... | |
static std::vector< std::string > | split (const std::string &s, char delim='/', bool skip_empty=true) |
Splits the string s into the return vector of tokens using the delimiter delim and skipping empty values as instructed by skip_empty. More... | |
static BESCatalog * | separateCatalogFromPath (std::string &path) |
|
static |
Assemble path fragments making sure that they are separated by a single '/' character.
If the parameter ensureLeadingSlash is true then the returned string will begin with a single '/' character followed by the string firstPart, a single '/' character, and the string secondPart.
firstPart | The first string to concatenate. |
secondPart | The second string to concatenate. |
leadingSlash | If this bool value is true then the returned string will have a leading slash. If the value of leadingSlash is false then the first character of the returned string will be the first character of the passed firstPart. |
trailingSlash | If this bool is true then the returned string will end it a slash. If trailingSlash is false, then the returned string will not end with a slash. If trailing slash(es) need to be removed to accomplish this, then they will be removed. |
Definition at line 821 of file BESUtil.cc.
|
static |
Check if the specified path is valid.
Check if the specified path is valid
Checks to see if the specified path is a valid path or not. The root directory specified is assumed to be valid, so we don't check that part of the path. The path parameter is relative to the root directory.
If follow_sym_links is false, then if any part of the specified path is a symbolic link, this function will return false, set the passed has_sym_link parameter. No error message is specified.
If there is a problem accessing the specified path then the error string will be filled with whatever system error message is provided.
param path path to check param root root directory path, assumed to be valid param follow_sym_links specifies whether allowed to follow symbolic links throws BESForbiddenError if the user is not allowed to traverse the path throws BESNotFoundError if there is a problem accessing the path or the path does not exist.
Definition at line 254 of file BESUtil.cc.
|
static |
If the value of the BES Key BES.CancelTimeoutOnSend is true, cancel the timeout. The intent of this is to stop the timeout counter once the BES starts sending data back since, the network link used by a remote client may be low-bandwidth and data providers might want to ensure those users get their data (and don't submit second, third, ..., requests when/if the first one fails). The timeout is initiated in the BES framework when it first processes the request.
Definition at line 967 of file BESUtil.cc.
|
static |
Returns true if (the value of) 'fullString' ends with (the value of) 'ending', false otherwise.
Definition at line 942 of file BESUtil.cc.
|
static |
explode a string into an array given a delimiter
Given a string of values separated by a delimiter, break out the values and store in the list.
Quoted values must be escaped.
If values contain the delimiter then the value must be wrapped in quotes.
delim | delimiter separating the values |
str | the original string |
values | list of the delimited values returned to caller |
BESInternalError | if missing ending quote or delimiter does not follow end quote |
Definition at line 561 of file BESUtil.cc.
|
static |
convert pid and place in provided buffer
Definition at line 436 of file BESUtil.cc.
|
static |
Returns the current time as an ISO8601 string.
use_local_time | True to use the local time, false (default) to use GMT |
Definition at line 1079 of file BESUtil.cc.
|
static |
Returns the time represented by 'the_time' as an ISO8601 string.
the_time | A time_t value |
use_local_time | True to use the local time, false (default) to use GMT |
Definition at line 1091 of file BESUtil.cc.
|
static |
convert characters not allowed in xml to escaped characters
Replace characters that are not allowed in XML
in | The string in which to replace characters. |
not_allowed | The set of characters that are not allowed in XML. default: ><&'(single quote)"(double quote) |
Definition at line 505 of file BESUtil.cc.
|
static |
implode a list of values into a single string delimited by delim
Given a list of string values create a single string of values delimited by delim
If the delimiter exists in a value in the list then that value must be enclosed in quotes
values | list of string values to implode |
delim | the delimiter to use in creating the resulting string |
Definition at line 638 of file BESUtil.cc.
|
static |
Convert a string to all lower case
Definition at line 200 of file BESUtil.cc.
|
static |
Removes duplicate separators and provides leading and trailing separators as directed.
raw_path | The string to normalize |
leading_separator | if true then the result will begin with a single separator character. If false the result will not begin with a separator character. |
trailing_separator | If true the result will end with a single separator character. If false the result will not end with a separator character. |
separator | A string, of length one, containing the separator character for the path. This parameter is optional and its value defaults to the slash '/' character. |
Definition at line 1011 of file BESUtil.cc.
|
static |
Concatenate path fragments making sure that they are separated by a single '/' character.
Returns a new string made from appending secondPart to firstPart while ensuring that a single separator appears between the two parts.
firstPart | The first string to concatenate. |
secondPart | The second string to concatenate. |
separator | The separator character to use between the two concatenated strings. Default: '/' |
Definition at line 772 of file BESUtil.cc.
|
static |
remove leading and trailing blanks from a string
Definition at line 466 of file BESUtil.cc.
|
static |
Operates on the string 's' to replaces every occurrence of the value of the string 'find_this' with the value of the string 'replace_with_this'.
Definition at line 989 of file BESUtil.cc.
|
static |
Generate an HTTP 1.0 response header for a html document.
strm | Write the MIME header to this ostream. |
Definition at line 102 of file BESUtil.cc.
|
static |
Generate an HTTP 1.0 response header for a text document.
strm | Write the MIME header to this ostream. |
Definition at line 83 of file BESUtil.cc.
|
static |
Splits the string s into the return vector of tokens using the delimiter delim and skipping empty values as instructed by skip_empty.
s | The string to tokenize. |
delim | The character delimiter to utilize during tokenization. default: '/' |
skip_empty | A boolean flag which controls if empty tokens are returned. |
Definition at line 1125 of file BESUtil.cc.
|
static |
A call out thanks to: http://www.oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html for the tokenizer.
Definition at line 1057 of file BESUtil.cc.
|
static |
Unescape characters with backslash before them
Definition at line 210 of file BESUtil.cc.
|
static |
Given a url, break the url into its different parts.
The different parts are the protocol, the domain name, a username if specified, a password if specified, a port if specified, and a path if specified.
struct url { string protocol ; string domain ; string uname ; string psswd ; string port ; string path ; } ;
url | string representation of the URL |
Definition at line 678 of file BESUtil.cc.
|
static |
This functions are used to unescape hex characters from strings
Definition at line 185 of file BESUtil.cc.
|
static |
unescape xml escaped characters
Given a string that contains XML escape sequences (i.e., entities), translate those back into ASCII characters. Return the modified string.
in | The string to modify. |
Definition at line 522 of file BESUtil.cc.