33 #include <HTTPConnect.h>
68 string err =
"Remote Request URL is empty" ;
72 BESDEBUG(
"gateway",
"GatewayRequest::make_request" << endl );
73 BESDEBUG(
"gateway",
" request = " << url << endl );
75 RCReader *rcr = RCReader::instance() ;
79 bool configure_proxy =
true;
84 if (r.match(url.c_str(), url.length()) != -1) {
86 configure_proxy =
false;
100 HTTPConnect connect( rcr ) ;
103 HTTPResponse *response = 0 ;
106 response = connect.fetch_url( url ) ;
115 string msg = (string)
"Unknown exception fetching remote request "
123 string msg = (string)
"Response empty fetching remote request " + url ;
130 if( response->get_status() != 200 && response->get_status() != 304 )
132 BESDEBUG(
"gateway",
" request FAILED with status "
133 << response->get_status() << endl );
139 BESDEBUG(
"gateway",
" reading text error from response file "
140 << response->get_file() << endl );
145 err +=
"Unable to load the error text" ;
155 if( type.empty() || type ==
"gateway" )
164 vector<string> *hdrs = response->get_headers() ;
167 vector<string>::const_iterator i = hdrs->begin() ;
168 vector<string>::const_iterator e = hdrs->end() ;
171 string hdr_line = (*i) ;
173 if( hdr_line.find(
"content-disposition" ) != string::npos )
178 if( hdr_line.find(
"content-type" ) != string::npos )
190 BESDEBUG(
"gateway",
"Looked at disposition " << disp
191 <<
" for type, returned \"" << type
199 if( type.empty() && !ctype.empty() )
202 BESDEBUG(
"gateway",
"Looked at content type " << ctype
203 <<
" for type, returned \"" << type
212 BESDEBUG(
"gateway",
"Looked at url " << url
213 <<
" for type, returned \"" << type
220 string err = (string)
"Unable to determine the type of data"
221 +
" returned from " + url ;
226 BESDEBUG(
"gateway",
"GatewayRequest::make_request - done" << endl );
static void read_error(const string &filename, string &err, const string &url)
read the target response file that contains textual error information
exception thrown if inernal error encountered
static string lowercase(const string &s)
Convert a string to all lower case.
static string ProxyProtocol
static string NoProxyRegex
error thrown if there is a user syntax error in the request or any other user error ...
static class NCMLUtil overview
static void Get_type_from_content_type(const string &ctype, string &type)
static void Get_type_from_disposition(const string &disp, string &type)
HTTPResponse * make_request(const string &url, string &type)
make the remote request against the given information
static void Get_type_from_url(const string &url, string &type)
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
static bool useInternalCache