OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
libcurl Namespace Reference

Functions

bool configureProxy (CURL *curl, const string &url)
 Configure the proxy options for the passed curl object. More...
 
string http_status_to_string (int status)
 This function translates an HTTP status code into an error messages. More...
 
CURL * init (char *error_buffer)
 Get's a new instance of CURL* and performs basic configuration of that instance. More...
 
long read_url (CURL *curl, const string &url, int fd, vector< string > *resp_hdrs, const vector< string > *request_headers, char error_buffer[])
 Use libcurl to dereference a URL. More...
 

Variables

int curl_trace = 0
 
const char * http_client_errors [CLIENT_ERR_MAX-CLIENT_ERR_MIN+1]
 
const char * http_server_errors [SERVER_ERR_MAX-SERVER_ERR_MIN+1]
 

Function Documentation

bool libcurl::configureProxy ( CURL *  curl,
const string &  url 
)

Configure the proxy options for the passed curl object.

The passed URL is the target URL. If the target URL matches the Gateway.NoProxyRegex in the config file, then no proxying is done.

The proxy configuration is stored in the gateway_modules configuration file, gateway.conf. The allowed values are: Gateway.ProxyHost=warsaw.wonderproxy.com Gateway.ProxyPort=8080 Gateway.ProxyUser=username Gateway.ProxyPassword=password Gateway.ProxyUserPW=username:password Gateway.ProxyAuthType=basic | digest | ntlm

Definition at line 304 of file curl_utils.cc.

References BESDEBUG, GatewayUtils::NoProxyRegex, GatewayUtils::ProxyAuthType, GatewayUtils::ProxyHost, GatewayUtils::ProxyPassword, GatewayUtils::ProxyPort, GatewayUtils::ProxyUser, and GatewayUtils::ProxyUserPW.

Referenced by gateway::RemoteHttpResource::RemoteHttpResource().

string libcurl::http_status_to_string ( int  status)

This function translates an HTTP status code into an error messages.

It works for those code greater than or equal to 400.

Definition at line 84 of file curl_utils.cc.

References CLIENT_ERR_MAX, CLIENT_ERR_MIN, SERVER_ERR_MAX, and SERVER_ERR_MIN.

CURL * libcurl::init ( char *  error_buffer)

Get's a new instance of CURL* and performs basic configuration of that instance.

  • Accept compressed responses
  • Any authentication type
  • Follow redirects
  • User agent set to curl versio.
Parameters
urlThe url used to configure the proy.

Definition at line 426 of file curl_utils.cc.

References BESDEBUG.

Referenced by BESRegex::BESRegex(), agg_util::RCPtr< ncml_module::AggregationElement >::operator=(), agg_util::RCPtr< ncml_module::AggregationElement >::RCPtr(), and gateway::RemoteHttpResource::RemoteHttpResource().

long libcurl::read_url ( CURL *  curl,
const string &  url,
int  fd,
vector< string > *  resp_hdrs,
const vector< string > *  request_headers,
char  error_buffer[] 
)

Use libcurl to dereference a URL.

Read the information referenced by url into the file pointed to by the open file descriptor fd.

Parameters
urlThe URL to dereference.
fdAn open file descriptor (as in 'open' as opposed to 'fopen') which will be the destination for the data; the caller can assume that when this method returns that the body of the response can be retrieved by reading from this file descriptor.
resp_hdrsValue/result parameter for the HTTP Response Headers.
request_headersA pointer to a vector of HTTP request headers. Default is null. These headers will be appended to the list of default headers.
Returns
The HTTP status code.
Exceptions
ErrorThrown if libcurl encounters a problem; the libcurl error message is stuffed into the Error object.

Definition at line 527 of file curl_utils.cc.

References BESDEBUG.

Variable Documentation

int libcurl::curl_trace = 0

Definition at line 39 of file curl_utils.cc.

const char* libcurl::http_client_errors[CLIENT_ERR_MAX-CLIENT_ERR_MIN+1]
Initial value:
=
{
"Bad Request:",
"Unauthorized: Contact the server administrator.",
"Payment Required.",
"Forbidden: Contact the server administrator.",
"Not Found: The data source or server could not be found.\n\
Often this means that the OPeNDAP server is missing or needs attention;\n\
Please contact the server administrator.",
"Method Not Allowed.",
"Not Acceptable.",
"Proxy Authentication Required.",
"Request Time-out.",
"Conflict.",
"Gone:.",
"Length Required.",
"Precondition Failed.",
"Request Entity Too Large.",
"Request URI Too Large.",
"Unsupported Media Type.",
"Requested Range Not Satisfiable.",
"Expectation Failed."
}

Definition at line 45 of file curl_utils.cc.

const char* libcurl::http_server_errors[SERVER_ERR_MAX-SERVER_ERR_MIN+1]
Initial value:
=
{
"Internal Server Error.",
"Not Implemented.",
"Bad Gateway.",
"Service Unavailable.",
"Gateway Time-out.",
"HTTP Version Not Supported."
}

Definition at line 71 of file curl_utils.cc.