bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
http Namespace Reference

utility class for the HTTP catalog module More...

Classes

class  AccessCredentials
 
class  AllowedHosts
 Can a given URL be dereferenced given the BES's configuration? More...
 
class  CredentialsManager
 
class  EffectiveUrl
 
class  EffectiveUrlCache
 
class  HttpError
 
class  ProxyConfig
 
class  RemoteResource
 
class  url
 Parse a URL into the protocol, host, path and query parts. More...
 

Functions

bool file_exists (const string &filename)
 
bool file_is_secured (const string &filename)
 
std::string get_env_value (const string &key)
 
void get_type_from_content_type (const string &ctype, string &type)
 
void get_type_from_disposition (const string &disp, string &type)
 
void get_type_from_url (const string &url, string &type)
 
void hexchar (const unsigned char &c, unsigned char &hex1, unsigned char &hex2)
 
size_t load_max_redirects_from_keys ()
 
void load_mime_list_from_keys (map< string, string > &mime_list)
 
void load_proxy_from_keys ()
 
string url_encode (const string &s)
 

Variables

std::once_flag d_cmac_init_once
 Run once_flag for initializing the singleton instance.
 

Detailed Description

utility class for the HTTP catalog module

This class provides utilities that extract information from a URL or the returned headers of an HTTP response. It also provides storage for a number of values read from the httpd_catalog.conf configuration file.

Note
This class holds only static methods and fields. It has no constructor or destructor. Use the initialize() method to configure the various static fields based on the values of the BES configuration file(s).

Function Documentation

◆ file_exists()

bool http::file_exists ( const string & filename)

Check for file existence

Parameters
filenameName of file to check
Returns
true if file exists, false otherwise.

Definition at line 205 of file CredentialsManager.cc.

◆ file_is_secured()

bool http::file_is_secured ( const string & filename)

Uses stat() to check that the passed file has the permissions 600 (rw----—). An exception is thrown if the file does not exist.

 modeval[0] = (perm & S_IRUSR) ? 'r' : '-';
 modeval[1] = (perm & S_IWUSR) ? 'w' : '-';
 modeval[2] = (perm & S_IXUSR) ? 'x' : '-';
 modeval[3] = (perm & S_IRGRP) ? 'r' : '-';
 modeval[4] = (perm & S_IWGRP) ? 'w' : '-';
 modeval[5] = (perm & S_IXGRP) ? 'x' : '-';
 modeval[6] = (perm & S_IROTH) ? 'r' : '-';
 modeval[7] = (perm & S_IWOTH) ? 'w' : '-';
 modeval[8] = (perm & S_IXOTH) ? 'x' : '-';
 modeval[9] = '\0';
Parameters
filename
Returns
True if the passed file exists and has the permissions 600 (rw----—)

Definition at line 230 of file CredentialsManager.cc.

◆ get_env_value()

std::string http::get_env_value ( const string & key)

Get get the specified environment value. This function returns an empty string if the environment variable is not found, AND if the environment value is set but empty.

Parameters
keyThe environment value to retrieve
Returns
The value of the environment variable, or the empty string is not found.

Definition at line 80 of file CredentialsManager.cc.

◆ get_type_from_content_type()

void http::get_type_from_content_type ( const string & ctype,
string & type )

Definition at line 148 of file HttpUtils.cc.

◆ get_type_from_disposition()

void http::get_type_from_disposition ( const string & disp,
string & type )

Look for the type of handler that can read the filename found in the

  • disp. The string
  • disp (probably from a HTTP Content-Dispoition header) has the format:
filename[#|=]<value>[ <attribute name>[#|=]<value>]
Parameters
dispThe disposition string
typeThe type of the handler that can read this file or the empty string if the BES Catalog Utils cannot find a handler to read it.

Definition at line 110 of file HttpUtils.cc.

◆ get_type_from_url()

void http::get_type_from_url ( const string & url,
string & type )

Definition at line 168 of file HttpUtils.cc.

◆ hexchar()

void http::hexchar ( const unsigned char & c,
unsigned char & hex1,
unsigned char & hex2 )

Thanks to https://gist.github.com/litefeel for this implementation

Parameters
c
hex1
hex2

Definition at line 202 of file HttpUtils.cc.

◆ load_max_redirects_from_keys()

size_t http::load_max_redirects_from_keys ( )

Loads the value of Http.MaxRedirects from TheBESKeys. If the value is not found, then it is set to the default, HTTP_MAX_REDIRECTS_DEFAULT

Definition at line 178 of file HttpUtils.cc.

◆ load_mime_list_from_keys()

void http::load_mime_list_from_keys ( map< string, string > & mime_list)

Loads the passed

Parameters
mime_list

Definition at line 72 of file HttpUtils.cc.

◆ url_encode()

std::string http::url_encode ( const string & s)

Thanks to https://gist.github.com/litefeel for this implementation

Parameters
s
Returns
s, but url encoded

Definition at line 215 of file HttpUtils.cc.

Variable Documentation

◆ d_cmac_init_once

std::once_flag http::d_cmac_init_once

Run once_flag for initializing the singleton instance.

Definition at line 66 of file CredentialsManager.cc.