9 #include <sys/socket.h>
26 using std::ostringstream;
34 edm::LogInfo(
"psetRetriever")<<
"filename is --> "<<filename<<
" <--";
46 SquidNet sn(3128,
"http://localhost:8000/RELEASE-NOTES.txt");
48 CURL* han = curl_easy_init();
51 XCEPT_RAISE(
evf::Exception,
"could not create handle for web ParameterSet");
54 struct curl_slist *headers=
NULL;
55 headers = curl_slist_append(headers,
"Pragma:");
56 curl_easy_setopt(han, CURLOPT_HTTPHEADER, headers);
57 char error[CURL_ERROR_SIZE];
59 curl_easy_setopt(han, CURLOPT_PROXY,
"localhost:3128");
61 curl_easy_setopt(han, CURLOPT_URL, hostname.c_str());
62 curl_easy_setopt(han, CURLOPT_VERBOSE,
"");
63 curl_easy_setopt(han, CURLOPT_NOSIGNAL,
"");
66 curl_easy_setopt(han, CURLOPT_WRITEFUNCTION, &
write_data);
67 curl_easy_setopt(han, CURLOPT_WRITEDATA, &
pset);
68 curl_easy_setopt(han, CURLOPT_ERRORBUFFER, error);
69 int success = curl_easy_perform(han);
70 curl_slist_free_all(headers);
71 curl_easy_cleanup(han);
76 msg <<
"could not get config from url " << in <<
" error #"
77 << success <<
" " <<
error;
82 han = curl_easy_init();
85 XCEPT_RAISE(
evf::Exception,
"could not create handle for web ParameterSet");
88 headers = curl_slist_append(headers,
"Pragma:");
89 curl_easy_setopt(han, CURLOPT_HTTPHEADER, headers);
91 curl_easy_setopt(han, CURLOPT_PROXY,
"localhost:3128");
93 curl_easy_setopt(han, CURLOPT_URL, hostname.c_str());
94 curl_easy_setopt(han, CURLOPT_VERBOSE,
"");
95 curl_easy_setopt(han, CURLOPT_NOSIGNAL,
"");
98 curl_easy_setopt(han, CURLOPT_WRITEFUNCTION, &
write_data);
100 curl_easy_setopt(han, CURLOPT_ERRORBUFFER, error);
101 success = curl_easy_perform(han);
102 curl_slist_free_all(headers);
103 curl_easy_cleanup(han);
108 msg <<
"could not get pathindex table from url " << in <<
" error #"
109 << success <<
" " <<
error;
117 XCEPT_RAISE(
evf::Exception,
"db access for ParameterSet not yet implemented");
121 edm::LogInfo(
"psetRetriever")<<
"Using string cfg from RunControl or XML";
142 string innohttp = in.substr(
webheading.size());
144 string host = innohttp.substr(0,pos);
145 string path = innohttp.substr(pos);
148 pos = path.find_last_of(
'.');
149 if(pos != string::npos)
151 string upath = path.substr(0,pos);
152 path = upath +
'.' + modifier;
155 struct hostent *heb = gethostbyname(host.c_str());
156 struct hostent *he = gethostbyaddr(heb->h_addr_list[0], heb->h_length, heb->h_addrtype);
157 string completehost =
"http://";
158 completehost += he->h_name;
159 completehost +=
path;
std::string getHostString(const std::string &in, std::string modifier="") const
std::string getAsString() const
std::string pathIndexTable
std::string getPathTableAsString() const
static size_t write_data(void *ptr, size_t size, size_t nmemb, void *pointer)
static const std::string dbheading
ParameterSetRetriever(const std::string &in)
static const std::string webheading
static const std::string fileheading