本文整理汇总了C++中curl_easy_perform函数的典型用法代码示例。如果您正苦于以下问题:C++ curl_easy_perform函数的具体用法?C++ curl_easy_perform怎么用?C++ curl_easy_perform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了curl_easy_perform函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rest_call_with_lock
StringInfo rest_call_with_lock(char *method, char *url, char *params, StringInfo postData, int64 mutex, bool shared, bool allowCancel) {
CURL *curl;
struct curl_slist *headers = NULL;
char *errorbuff;
StringInfo response = makeStringInfo();
CURLcode ret;
int64 response_code;
errorbuff = (char *) palloc0(CURL_ERROR_SIZE);
curl = curl_easy_init();
if (curl) {
headers = curl_slist_append(headers, "Transfer-Encoding:");
headers = curl_slist_append(headers, "Expect:");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 0L); /* allow connections to be reused */
if (allowCancel)
{
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); /* we want progress ... */
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, curl_progress_func); /* to go here so we can detect a ^C within postgres */
}
curl_easy_setopt(curl, CURLOPT_USERAGENT, "zombodb for PostgreSQL");
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 0);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write_func);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 0);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorbuff);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60 * 60L); /* timeout of 60 minutes */
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, method);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, response);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, postData ? postData->len : 0);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData ? postData->data : NULL);
curl_easy_setopt(curl, CURLOPT_POST, (strcmp(method, "POST") == 0) || (strcmp(method, "GET") != 0 && postData && postData->data) ? 1 : 0);
} else {
elog(IsTransactionState() ? ERROR : WARNING, "Unable to initialize libcurl");
}
// if (mutex != 0)
// {
// if (shared) DirectFunctionCall1(pg_advisory_lock_shared_int8, Int64GetDatum(mutex));
// else DirectFunctionCall1(pg_advisory_lock_int8, Int64GetDatum(mutex));
// }
ret = curl_easy_perform(curl);
// if (mutex != 0)
// {
// if (shared) DirectFunctionCall1(pg_advisory_unlock_shared_int8, Int64GetDatum(mutex));
// else DirectFunctionCall1(pg_advisory_unlock_int8, Int64GetDatum(mutex));
// }
if (allowCancel && IsTransactionState() && InterruptPending) {
/* we might have detected one in the progress function, so check for sure */
CHECK_FOR_INTERRUPTS();
}
if (ret != 0) {
/* curl messed up */
elog(IsTransactionState() ? ERROR : WARNING, "libcurl error-code: %s(%d); message: %s; req=-X%s %s ", curl_easy_strerror(ret), ret, errorbuff, method, url);
}
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
if (response_code < 200 || (response_code >=300 && response_code != 404)) {
text *errorText = DatumGetTextP(DirectFunctionCall2(json_object_field_text, CStringGetTextDatum(response->data), CStringGetTextDatum("error")));
elog(IsTransactionState() ? ERROR : WARNING, "rc=%ld; %s", response_code, errorText != NULL ? TextDatumGetCString(errorText) : response->data);
}
if (headers)
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
pfree(errorbuff);
return response;
}
开发者ID:jkburges,项目名称:zombodb,代码行数:79,代码来源:rest.c
示例2: url_remove_listener
static auth_result url_remove_listener (auth_client *auth_user)
{
client_t *client = auth_user->client;
auth_url *url = auth_user->auth->state;
auth_thread_data *atd = auth_user->thread_data;
time_t now = time(NULL), duration = now - client->connection.con_time;
char *username, *password, *mount, *server, *ipaddr, *user_agent;
const char *qargs, *tmp;
char *userpwd = NULL, post [4096];
if (url->removeurl == NULL || client == NULL)
return AUTH_OK;
if (url->stop_req_until)
{
if (url->stop_req_until >= now)
return AUTH_FAILED;
url->stop_req_until = 0;
}
server = util_url_escape (auth_user->hostname);
if (client->username)
username = util_url_escape (client->username);
else
username = strdup ("");
if (client->password)
password = util_url_escape (client->password);
else
password = strdup ("");
tmp = httpp_getvar(client->parser, "user-agent");
if (tmp == NULL)
tmp = "-";
user_agent = util_url_escape (tmp);
/* get the full uri (with query params if available) */
qargs = httpp_getvar (client->parser, HTTPP_VAR_QUERYARGS);
snprintf (post, sizeof post, "%s%s", auth_user->mount, qargs ? qargs : "");
mount = util_url_escape (post);
ipaddr = util_url_escape (client->connection.ip);
snprintf (post, sizeof (post),
"action=listener_remove&server=%s&port=%d&client=%" PRIu64 "&mount=%s"
"&user=%s&pass=%s&ip=%s&duration=%lu&agent=%s&sent=%" PRIu64,
server, auth_user->port, client->connection.id, mount, username,
password, ipaddr, (long unsigned)duration, user_agent, client->connection.sent_bytes);
free (ipaddr);
free (server);
free (mount);
free (username);
free (password);
free (user_agent);
if (strchr (url->removeurl, '@') == NULL)
{
if (url->userpwd)
curl_easy_setopt (atd->curl, CURLOPT_USERPWD, url->userpwd);
else
{
/* auth'd requests may not have a user/pass, but may use query args */
if (client->username && client->password)
{
int len = strlen (client->username) + strlen (client->password) + 2;
userpwd = malloc (len);
snprintf (userpwd, len, "%s:%s", client->username, client->password);
curl_easy_setopt (atd->curl, CURLOPT_USERPWD, userpwd);
}
else
curl_easy_setopt (atd->curl, CURLOPT_USERPWD, "");
}
}
else
{
/* url has user/pass but libcurl may need to clear any existing settings */
curl_easy_setopt (atd->curl, CURLOPT_USERPWD, "");
}
curl_easy_setopt (atd->curl, CURLOPT_URL, url->removeurl);
curl_easy_setopt (atd->curl, CURLOPT_POSTFIELDS, post);
curl_easy_setopt (atd->curl, CURLOPT_WRITEHEADER, auth_user);
curl_easy_setopt (atd->curl, CURLOPT_WRITEDATA, auth_user);
DEBUG2 ("...handler %d (%s) sending request", auth_user->handler, auth_user->mount);
if (curl_easy_perform (atd->curl))
{
WARN3 ("auth to server %s (%s) failed with \"%s\"", url->removeurl, auth_user->mount, atd->errormsg);
url->stop_req_until = time (NULL) + url->stop_req_duration; /* prevent further attempts for a while */
}
else
DEBUG2 ("...handler %d (%s) request complete", auth_user->handler, auth_user->mount);
free (userpwd);
return AUTH_OK;
}
开发者ID:kjwierenga,项目名称:icecast-kh,代码行数:94,代码来源:auth_url.c
示例3: my_on_reporting
//.........这里部分代码省略.........
}
}
if (globals.ssl_cacert_file) {
curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file);
}
/* these were used for testing, optionally they may be enabled if someone desires
curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
*/
for (cur_try = 0; cur_try < globals.retries; cur_try++) {
if (cur_try > 0) {
switch_yield(globals.delay * 1000000);
}
destUrl = switch_mprintf("%s?uuid=%s", globals.urls[globals.url_index], switch_core_session_get_uuid(session));
curl_easy_setopt(curl_handle, CURLOPT_URL, destUrl);
if (!strncasecmp(destUrl, "https", 5)) {
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
}
if (globals.enable_cacert_check) {
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, TRUE);
}
if (globals.enable_ssl_verifyhost) {
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
}
curl_easy_perform(curl_handle);
curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
switch_safe_free(destUrl);
if (httpRes == 200) {
goto success;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n",
httpRes, globals.urls[globals.url_index]);
globals.url_index++;
switch_assert(globals.url_count <= MAX_URLS);
if (globals.url_index >= globals.url_count) {
globals.url_index = 0;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Retry will be with url [%s]\n", globals.urls[globals.url_index]);
}
}
curl_easy_cleanup(curl_handle);
curl_slist_free_all(headers);
curl_slist_free_all(slist);
slist = NULL;
headers = NULL;
curl_handle = NULL;
/* if we are here the web post failed for some reason */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n");
for (err_dir_index = 0; err_dir_index < globals.err_dir_count; err_dir_index++) {
switch_thread_rwlock_rdlock(globals.log_path_lock);
path = switch_mprintf("%s%s%s%s.cdr.json", globals.err_log_dir[err_dir_index], SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session));
switch_thread_rwlock_unlock(globals.log_path_lock);
if (path) {
#ifdef _MSC_VER
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
开发者ID:kgrofelnik,项目名称:mod_portaudio-endpoints,代码行数:67,代码来源:mod_json_cdr.c
示例4: acvp_curl_http_post
/*
* This function uses libcurl to send a simple HTTP POST
* request with no Content-Type header.
* TLS peer verification is enabled, but not HTTP authentication.
* The parameters are:
*
* ctx: Ptr to ACVP_CTX, which contains the server name
* url: URL to use for the GET request
* data: data to POST to the server
* writefunc: Function pointer to handle writing the data
* from the HTTP body received from the server.
*
* Return value is the HTTP status value from the server
* (e.g. 200 for HTTP OK)
*/
static long acvp_curl_http_post(ACVP_CTX *ctx, char *url, char *data, int data_len) {
long http_code = 0;
CURL *hnd;
CURLcode crv;
struct curl_slist *slist;
char user_agent_str[USER_AGENT_STR_MAX + 1];
/*
* Set the Content-Type header in the HTTP request
*/
slist = NULL;
slist = curl_slist_append(slist, "Content-Type:application/json");
/*
* Create the Authorzation header if needed
*/
slist = acvp_add_auth_hdr(ctx, slist);
ctx->curl_read_ctr = 0;
/*
* Create the HTTP User Agent value
*/
snprintf(user_agent_str, USER_AGENT_STR_MAX, "libacvp/%s", ACVP_VERSION);
/*
* Setup Curl
*/
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_URL, url);
curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, user_agent_str);
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_POST, 1L);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, data);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)data_len);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
curl_easy_setopt(hnd, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
/*
* Always verify the server
*/
curl_easy_setopt(hnd, CURLOPT_SSL_VERIFYPEER, 1L);
if (ctx->cacerts_file) {
curl_easy_setopt(hnd, CURLOPT_CAINFO, ctx->cacerts_file);
curl_easy_setopt(hnd, CURLOPT_CERTINFO, 1L);
}
/*
* Mutual-auth
*/
if (ctx->tls_cert && ctx->tls_key) {
curl_easy_setopt(hnd, CURLOPT_SSLCERTTYPE, "PEM");
curl_easy_setopt(hnd, CURLOPT_SSLCERT, ctx->tls_cert);
curl_easy_setopt(hnd, CURLOPT_SSLKEYTYPE, "PEM");
curl_easy_setopt(hnd, CURLOPT_SSLKEY, ctx->tls_key);
}
/*
* To record the HTTP data recieved from the server,
* set the callback function.
*/
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, ctx);
curl_easy_setopt(hnd, CURLOPT_WRITEFUNCTION, &acvp_curl_write_callback);
if (ctx->curl_buf) {
/* Clear the HTTP buffer for next server response */
memzero_s(ctx->curl_buf, ACVP_CURL_BUF_MAX);
}
/*
* Send the HTTP POST request
*/
crv = curl_easy_perform(hnd);
if (crv != CURLE_OK) {
ACVP_LOG_ERR("Curl failed with code %d (%s)\n", crv, curl_easy_strerror(crv));
}
/*
* Get the HTTP reponse status code from the server
*/
curl_easy_getinfo(hnd, CURLINFO_RESPONSE_CODE, &http_code);
curl_easy_cleanup(hnd);
//.........这里部分代码省略.........
开发者ID:cisco,项目名称:libacvp,代码行数:101,代码来源:acvp_transport.c
示例5: main
int main(int argc, char **argv) {
CURL *curl;
CURLcode res;
struct curl_slist* slist = NULL;
struct stringbuffer buffer;
long resp_code = 0;
char *token = NULL;
curl = curl_easy_init();
stringbuffer_init(&buffer);
if (curl) {
/** Let it be known that I refuse to write manual, string-quoted JSON. */
slist = curl_slist_append(slist, "Content-type: application/json");
json_object *body_obj = json_object_new_object();
json_object *auth_obj = json_object_new_object();
json_object *cred_obj = json_object_new_object();
json_object *tenant_str = json_object_new_string(KEYSTONE_TENANT);
json_object *user_str = json_object_new_string(KEYSTONE_USER);
json_object *pass_str = json_object_new_string(KEYSTONE_PASS);
json_object_object_add(body_obj, "auth", auth_obj);
json_object_object_add(auth_obj, "passwordCredentials", cred_obj);
json_object_object_add(auth_obj, "tenantName", tenant_str);
json_object_object_add(cred_obj, "username", user_str);
json_object_object_add(cred_obj, "password", pass_str);
const char* body = json_object_to_json_string(body_obj);
//printf("body[%d]:\n%s\n\n", strlen(body), body);
curl_easy_setopt(curl, CURLOPT_URL, KEYSTONE_URL);
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, (void*) http_received_data);
res = curl_easy_perform(curl);
json_object_put(body_obj);
json_object_put(auth_obj);
json_object_put(cred_obj);
json_object_put(user_str);
json_object_put(pass_str);
json_object_put(tenant_str);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &resp_code);
//printf("HTTP %d\n", resp_code);
//printf("body[%d]\n%s\n\n", buffer.len, buffer.ptr);
if (res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
}
else if (resp_code == 200) {
json_object *json = json_tokener_parse(buffer.ptr);
json_object *access_obj = json_object_object_get(json, "access");
json_object *token_obj = json_object_object_get(access_obj, "token");
json_object *id_obj = json_object_object_get(token_obj, "id");
const char* tmp_token = json_object_get_string(id_obj);
token = malloc(strlen(tmp_token) + 1);
strcpy(token, tmp_token);
json_object_put(id_obj);
json_object_put(token_obj);
json_object_put(access_obj);
json_object_put(json);
}
else {
fprintf(stderr, "Could not authenticate (HTTP %d received).\n", resp_code);
}
stringbuffer_free(&buffer);
curl_easy_cleanup(curl);
curl_slist_free_all(slist);
}
if (token != NULL) {
printf("token is %s\n", token);
}
return 0;
}
开发者ID:briancline,项目名称:keystone-pam,代码行数:86,代码来源:test.c
示例6: curl_slist_append
int Service::PostSoap( char *wsdlUrl,char *SoapActionStr,char *xmlbuffer,
char *failstr)
{
m_resp_buffer="";
m_resp_header="";
//默认写入写出都是UTF-8模式 XML不用再次转换
struct curl_slist *headers = NULL;
/*
headers = curl_slist_append(headers, "Content-Type: text/xml;charset=UTF-8");
//targetNamespace + 方法名 name
//headers = curl_slist_append(headers, "SOAPAction: \"http://push.services.webService.vm.yr.com/videoReadPushSend\"");
headers = curl_slist_append(headers, SoapActionStr);
*/
//headers = curl_slist_append(headers, "Content-Type: application/soap+xml;charset=UTF-8;action=\"urn:initSystem\"");
//headers = curl_slist_append(headers, SoapActionStr);
//headers = curl_slist_append(headers, "Content-Type: text/xml;charset=UTF-8");
CURL *curl = curl_easy_init();
if ( curl )
{
//WSDL路径
//curl_easy_setopt(curl, CURLOPT_URL, "http://10.142.50.248:8086/uvss/services/infoPushSend");
curl_easy_setopt(curl, CURLOPT_URL,wsdlUrl);
char errorBuffer[CURL_ERROR_SIZE]={0};
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
// curl_easy_setopt(curl, CURLOPT_HEADER, 1);
// curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, xmlbuffer);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(xmlbuffer));
curl_easy_setopt(curl, CURLOPT_POST, 1);
//回报数据
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, this);
int timeout=10;
//设置URL地址错误 重连N次后推出
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, timeout);
//设置最低速度。为了中途拔网线
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 10);
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, timeout);
if(CSERVER_DEBUG)
curl_easy_setopt(curl, CURLOPT_VERBOSE , 1);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
//curl_easy_setopt(curl, CURLOPT_PROXY, "10.142.50.140:808");
CURLcode curl_code = curl_easy_perform(curl);
/* always cleanup */
int http_code = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
// clean up
curl_easy_cleanup(curl);
// curl_slist_free_all(headers);
if ( curl_code != CURLE_OK )
{
cout << "\nError: [" << curl_code << "] - " << errorBuffer;
//DebugPrintA(2, "\nError--%s\n",errorBuffer);
error_str = errorBuffer;
//linux modify callback error info????
//::MessageBoxA(NULL,error_str.c_str(),"HttpReq-ER",0);
sprintf(failstr,"Cservice postcode %s",curl_easy_strerror(curl_code));
return curl_code;
}
else if ( 400 <= http_code )
{
//DebugPrintA(3, "Http-code=%d",http_code);
int start, end;
start = m_resp_buffer.find("<internalReason>");
end = m_resp_buffer.find("</internalReason>");
if( start>=0 && end>=0 && end>start )
{
start += 16;
error_str = m_resp_buffer.substr(start, end-start);
}
else
error_str = m_resp_buffer;
sprintf(failstr,"Cservice httpcode %d",http_code);
return http_code;
}
else
error_str = "";
return CURLE_OK;
}
else
{
sprintf(failstr,"Cservice postinit fail");
//.........这里部分代码省略.........
开发者ID:dulton,项目名称:brpj,代码行数:101,代码来源:CService.cpp
示例7: test
//.........这里部分代码省略.........
tdata.url = suburl(URL, i); /* must be curl_free()d */
tdata.share = share;
/* simulate thread, direct call of "thread" function */
printf("*** run %d\n",i);
fire(&tdata);
curl_free(tdata.url);
}
/* fetch a another one and save cookies */
printf("*** run %d\n", i);
curl = curl_easy_init();
if(!curl) {
fprintf(stderr, "curl_easy_init() failed\n");
curl_share_cleanup(share);
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD;
}
url = suburl(URL, i);
headers = sethost(NULL);
test_setopt(curl, CURLOPT_HTTPHEADER, headers);
test_setopt(curl, CURLOPT_URL, url);
printf("CURLOPT_SHARE\n");
test_setopt(curl, CURLOPT_SHARE, share);
printf("CURLOPT_COOKIEJAR\n");
test_setopt(curl, CURLOPT_COOKIEJAR, JAR);
printf("CURLOPT_COOKIELIST FLUSH\n");
test_setopt(curl, CURLOPT_COOKIELIST, "FLUSH");
printf("PERFORM\n");
curl_easy_perform(curl);
printf("CLEANUP\n");
curl_easy_cleanup(curl);
curl_free(url);
curl_slist_free_all(headers);
/* load cookies */
curl = curl_easy_init();
if(!curl) {
fprintf(stderr, "curl_easy_init() failed\n");
curl_share_cleanup(share);
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD;
}
url = suburl(URL, i);
headers = sethost(NULL);
test_setopt(curl, CURLOPT_HTTPHEADER, headers);
test_setopt(curl, CURLOPT_URL, url);
printf("CURLOPT_SHARE\n");
test_setopt(curl, CURLOPT_SHARE, share);
printf("CURLOPT_COOKIELIST ALL\n");
test_setopt(curl, CURLOPT_COOKIELIST, "ALL");
printf("CURLOPT_COOKIEJAR\n");
test_setopt(curl, CURLOPT_COOKIEFILE, JAR);
printf("CURLOPT_COOKIELIST RELOAD\n");
test_setopt(curl, CURLOPT_COOKIELIST, "RELOAD");
code = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
if(code != CURLE_OK) {
fprintf(stderr, "curl_easy_getinfo() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
开发者ID:hydnoracoin,项目名称:Open-Source-Cryptocurrency-Exchange,代码行数:67,代码来源:lib506.c
示例8: GetSignedURL
int GetSignedURL(char* Auth_token, char* signedURL, char* upfile)
{
CURL* curl;
CURLcode res;
FILE* temfile;
struct curl_slist* headers = NULL;
char Auth_signedurl[128];
char auth_header[] = "Authorization: Bearer ";
logger_cloud("%s: Entering ...", __FUNCTION__);
memset((char*)&Auth_signedurl[0], '\0', 128);
//Setup file name json format
sprintf((char*)&Filename[0], "{\"filename\":\"%s\"}", upfile);
//headers = curl_slist_append(headers, Accept);
headers = curl_slist_append(headers, CLOUD_ACCEPT);
headers = curl_slist_append(headers, CLOUD_DEVICE);
headers = curl_slist_append(headers, Content);
//Authorization for GetSignedURL must get from GetToken
strcat((char*)&Auth_signedurl[0], (char*)&auth_header[0]);
strcat((char*)&Auth_signedurl[0], Auth_token);
headers = curl_slist_append(headers, (char*)&Auth_signedurl[0]);
/* In windows, this will init the Winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);
/* get a curl handle */
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, GetSignedURL_Response);
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, GetSignedURL_Header_Response);
if (endpoint_url == 1)
{
curl_easy_setopt(curl, CURLOPT_URL, QA_AWS_SIGNED);
curl_easy_setopt(curl, CURLOPT_CAPATH, "/odi/conf/m2mqtt_ca_qa.crt");
}
else
{
curl_easy_setopt(curl, CURLOPT_URL, PROD_AWS_SIGNED);
curl_easy_setopt(curl, CURLOPT_CAPATH, "/odi/conf/m2mqtt_ca_prod.crt");
}
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
// curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, Filename);
/* Now run off and do what you've been told! */
res = curl_easy_perform(curl);
/* Check for errors */
if (res != CURLE_OK)
{
logger_cloud("%s:curl_easy_perform() failed: %s\n", __FUNCTION__, curl_easy_strerror(res));
GetSignedURL_ret = SIGNEDURL_ERR;
}
/* always cleanup */
curl_easy_cleanup(curl);
}
memcpy(signedURL, (char*)&local_signedURL[0], SIGNEDURL_SIZE);
curl_global_cleanup();
return GetSignedURL_ret;
}
开发者ID:giacdinh,项目名称:rr_apps,代码行数:70,代码来源:GetSignedURL.c
示例9: upyun_request_internal
//.........这里部分代码省略.........
{
/* curl_easy_setopt(curl, CURLOPT_POST, 1L); */
curl_easy_setopt(curl,CURLOPT_CUSTOMREQUEST,"POST");
}
else if(request->method == UPYUN_HTTP_METHOD_PUT)
{
curl_easy_setopt(curl, CURLOPT_PUT, 1L);
}
else if(request->method == UPYUN_HTTP_METHOD_DELETE)
{
curl_easy_setopt(curl,CURLOPT_CUSTOMREQUEST,"DELETE");
}
if(request->method == UPYUN_HTTP_METHOD_PUT
|| request->method == UPYUN_HTTP_METHOD_POST)
{
if(request->upload_content != NULL)
{
copy_upload_content = *(request->upload_content);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_content_callback);
curl_easy_setopt(curl, CURLOPT_READDATA, ©_upload_content);
}
}
if(request->need_headers_out)
{
curl_easy_setopt(curl, CURLOPT_HEADERDATA, &request->headers_out);
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, response_header_callback);
}
size_t content_len = 0;
if(request->method == UPYUN_HTTP_METHOD_POST ||
request->method == UPYUN_HTTP_METHOD_PUT)
{
content_len = request->upload_content != NULL
? request->upload_content->len : 0;
}
char time_buf[MAX_BUF_LEN] = {0};
get_rfc1123_date(time_buf, 100);
char auth_header[MAX_BUF_LEN] = {0};
upyun_generate_auth_header(thiz->config->user, thiz->config->passwd,
request->method, content_len, quoted_uri, auth_header, time_buf);
curl_headers = curl_slist_append(curl_headers, auth_header);
curl_headers = curl_slist_append(curl_headers,
upyun_endpoints[thiz->config->endpoint]);
char buf[MAX_BUF_LEN] = {0};
snprintf(buf, MAX_BUF_LEN, "DATE: %s", time_buf);
curl_headers = curl_slist_append(curl_headers, buf);
if(request->upload_content)
{
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
(curl_off_t)(request->upload_content->len));
/*sprintf(buf, "Content-Length: %zu", request->upload_content->len);*/
if(request->upload_content->md5)
{
char md5_buf[34] = {0};
if(upyun_content_md5(request->upload_content, md5_buf) == 0) goto DONE;
sprintf(buf, "Content-MD5: %s", md5_buf);
curl_slist_append(curl_headers, buf);
}
}
else
{
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE,
(curl_off_t) 0);
strcpy(buf, "Content-Length: 0");
curl_headers = curl_slist_append(curl_headers, buf);
}
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, curl_headers);
if(request->content_callback)
{
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, request->content_callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, request->content_ctx);
}
if(request->timeout <= 0) curl_easy_setopt(curl, CURLOPT_TIMEOUT, 0);
else curl_easy_setopt(curl, CURLOPT_TIMEOUT, request->timeout);
/* No signals allowed in case of multithreaded apps */
/* TODO what if there is problem in dns parsing? */
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
if(thiz->config->debug) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
else curl_easy_setopt(curl, CURLOPT_VERBOSE, 0);
CURLcode rv = curl_easy_perform(curl);
if(rv != CURLE_OK) ret = UPYUN_RET_HTTP_FAIL;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &request->status);
DONE:
*headers = curl_headers;
return ret;
}
开发者ID:Valar-Morghulis,项目名称:cUPYun,代码行数:101,代码来源:upyun.c
示例10: go
static JSBool
go(JSContext* cx, JSObject* obj, HTTPData* http, char* body, size_t bodylen)
{
CurlState state;
JSString* jsbody;
JSBool ret = JS_FALSE;
jsval tmp;
state.cx = cx;
state.http = http;
state.sendbuf = body;
state.sendlen = bodylen;
state.sent = 0;
state.sent_once = 0;
state.recvbuf = NULL;
state.recvlen = 0;
state.read = 0;
if(HTTP_HANDLE == NULL) {
HTTP_HANDLE = curl_easy_init();
curl_easy_setopt(HTTP_HANDLE, CURLOPT_READFUNCTION, send_body);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_SEEKFUNCTION,
(curl_seek_callback) seek_body);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_HEADERFUNCTION, recv_header);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_WRITEFUNCTION, recv_body);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_ERRORBUFFER, ERRBUF);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_COOKIEFILE, "");
curl_easy_setopt(HTTP_HANDLE, CURLOPT_REFERER, "http://127.0.0.1:5984/");
curl_easy_setopt(HTTP_HANDLE, CURLOPT_USERAGENT,
"CouchHTTP Client - Relax");
}
if(!HTTP_HANDLE) {
JS_ReportError(cx, "Failed to initialize cURL handle.");
goto done;
}
if(http->method < 0 || http->method > OPTIONS) {
JS_ReportError(cx, "INTERNAL: Unknown method.");
goto done;
}
curl_easy_setopt(HTTP_HANDLE, CURLOPT_CUSTOMREQUEST, METHODS[http->method]);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_NOBODY, 0);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_UPLOAD, 0);
if(http->method == HEAD) {
curl_easy_setopt(HTTP_HANDLE, CURLOPT_NOBODY, 1);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_FOLLOWLOCATION, 0);
} else if(http->method == POST || http->method == PUT) {
curl_easy_setopt(HTTP_HANDLE, CURLOPT_UPLOAD, 1);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_FOLLOWLOCATION, 0);
}
if(body && bodylen) {
curl_easy_setopt(HTTP_HANDLE, CURLOPT_INFILESIZE, bodylen);
} else {
curl_easy_setopt(HTTP_HANDLE, CURLOPT_INFILESIZE, 0);
}
// curl_easy_setopt(HTTP_HANDLE, CURLOPT_VERBOSE, 1);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_URL, http->url);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_HTTPHEADER, http->req_headers);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_READDATA, &state);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_SEEKDATA, &state);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_WRITEHEADER, &state);
curl_easy_setopt(HTTP_HANDLE, CURLOPT_WRITEDATA, &state);
if(curl_easy_perform(HTTP_HANDLE) != 0) {
JS_ReportError(cx, "Failed to execute HTTP request: %s", ERRBUF);
goto done;
}
if(!state.resp_headers) {
JS_ReportError(cx, "Failed to recieve HTTP headers.");
goto done;
}
tmp = OBJECT_TO_JSVAL(state.resp_headers);
if(!JS_DefineProperty(
cx, obj,
"_headers",
tmp,
NULL, NULL,
JSPROP_READONLY
)) {
JS_ReportError(cx, "INTERNAL: Failed to set response headers.");
goto done;
}
if(state.recvbuf) {
state.recvbuf[state.read] = '\0';
jsbody = dec_string(cx, state.recvbuf, state.read+1);
if(!jsbody) {
//.........这里部分代码省略.........
开发者ID:hofmeister,项目名称:couchdb,代码行数:101,代码来源:http.c
示例11: nsp_feed_update_icon
int
nsp_feed_update_icon(NspFeed *feed)
{
NspNetData *data;
char *icon_url = NULL;
char *icon_path = NULL;
GRegex *regex;
GMatchInfo *match_info;
CURL *curl;
CURLcode result;
GdkPixbufLoader *loader = NULL;
GError *error = NULL;
char *feed_id_string = NULL;
/* Download web page */
data = nsp_net_new();
if ( nsp_net_load_url(feed->site_url, data) ) {
g_warning("ERROR: %s\n", data->error);
nsp_net_free(data);
return 1;
}
/* Find <link> tag reffering to the icon */
regex = g_regex_new ("<link[^>]*?rel=[\"'](icon|shortcut icon)[\"'][^>]*?href=[\"'](?<href>.*?)[\"'][^>]*?>", 0, 0, NULL);
g_regex_match (regex, data->content, 0, &match_info);
while (g_match_info_matches (match_info)) {
gchar *word = g_match_info_fetch_named (match_info, "href");
if ( !g_str_has_prefix(word, "http") ) {
icon_url = g_strdup_printf("%s/%s", feed->site_url, word);
g_free(word);
break;
}
g_free (word);
g_match_info_next (match_info, NULL);
}
g_match_info_free (match_info);
g_regex_unref (regex);
nsp_net_free(data);
/* If no image is found - use home url + /favicon.ico */
if ( icon_url == NULL ) {
regex = g_regex_new ("^(?<hostname>https?://[^/]*)", 0, 0, NULL);
g_regex_match (regex, feed->site_url, 0, &match_info);
if (g_match_info_matches (match_info)) {
gchar *word = g_match_info_fetch_named (match_info, "hostname");
icon_url = g_strdup_printf("%s/favicon.ico", word);
g_free (word);
}
g_match_info_free (match_info);
g_regex_unref (regex);
}
/* Store the image to a GtkPixbufLoader */
loader = gdk_pixbuf_loader_new();
curl = curl_easy_init();
curl_easy_setopt (curl, CURLOPT_URL, icon_url);
curl_easy_setopt (curl, CURLOPT_HEADER, 0);
curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, nsp_feed_download_icon_cb );
curl_easy_setopt (curl, CURLOPT_WRITEDATA, loader);
curl_easy_setopt (curl, CURLOPT_TIMEOUT, 60);
curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1);
result = curl_easy_perform (curl);
curl_easy_cleanup(curl);
g_free(icon_url);
if ( result != 0) {
return 1;
}
gdk_pixbuf_loader_close (loader, NULL);
feed->icon = gdk_pixbuf_loader_get_pixbuf (loader);
if ( !GDK_IS_PIXBUF(feed->icon) ) {
feed->icon = NULL;
return 1;
}
/* Resize and save the image */
if (gdk_pixbuf_get_width (feed->icon) != 16 || gdk_pixbuf_get_height (feed->icon) != 16) {
GdkPixbuf *old = feed->icon;
feed->icon = gdk_pixbuf_scale_simple (old, 16, 16, GDK_INTERP_BILINEAR);
g_object_unref (G_OBJECT (old));
}
feed_id_string = malloc(sizeof(char)*9);
g_snprintf (feed_id_string, 9, "%i", feed->id);
icon_path = g_build_filename( g_get_user_data_dir(), PACKAGE, "/icons", NULL);
g_mkdir_with_parents(icon_path, 0700);
icon_path = g_build_filename( icon_path, "/", feed_id_string, NULL);
gdk_pixbuf_save(feed->icon, icon_path, "png", &error, NULL);
if ( error != NULL ) {
g_warning("ERROR: %s\n", error->message);
//.........这里部分代码省略.........
开发者ID:Michael-Z,项目名称:Nowspide,代码行数:101,代码来源:nsp-feed.c
示例12: getrequest
struct block getrequest(CURL *curl_handle, const char *url, FILE *hfile)
{
char *ct = NULL;
struct block b, h;
int res;
struct HeaderStruct head;
struct MemoryStruct chunk;
chunk.memory = (char *)malloc(1); /* will be grown as needed by the realloc above */
chunk.size = 0; /* no data at this point */
head.memory = (char *)malloc(1); /* will be grown as needed by the realloc above */
head.size = 0; /* no data at this point */
head.download = 0; /* not yet known at this point */
setmainheaders(curl_handle, url);
setrequestheaders(curl_handle, GET);
if(curl_handle) {
/* we pass our 'chunk' struct or 'hfile' to the callback function */
if(hfile)
{
/* send all data to this function */
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, writedata);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)hfile);
}
else
{
curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, parseheader);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, (void *)&head);
}
if ((res = curl_easy_perform(curl_handle)) != 0) /*error!*/
{
if (res == CURLE_ABORTED_BY_CALLBACK)
{
h.size = DSTOPPED;
return h;
}
if (res == CURLE_WRITE_ERROR)
{
fillstruct(curl_handle, &head, &h);
free(head.memory);
return h;
}
Debug(curl_easy_strerror((CURLcode)res));
return emptyblock;
}
if(CURLE_OK != curl_easy_getinfo(curl_handle, CURLINFO_CONTENT_TYPE, &ct) || !ct)
return emptyblock;
}
else
return emptyblock;
b.data = chunk.memory;
b.size = chunk.size;
findChr(ct, ';');
strcpy(b.type, ct);
free(head.memory);
if(hfile)
{
h.size = DCOMPLETE;
fclose(hfile);
return h;
}
return b;
}
开发者ID:Gamer125,项目名称:wiibrowser,代码行数:74,代码来源:httplib.cpp
示例13: postrequest
struct block postrequest(CURL *curl_handle, const char *url, curl_httppost *data)
{
char *ct = NULL;
char *post = findRchr(url, '?');
struct block b, h;
int res;
struct HeaderStruct head;
struct MemoryStruct chunk;
chunk.memory = (char *)malloc(1); /* will be grown as needed by the realloc above */
chunk.size = 0; /* no data at this point */
head.memory = (char *)malloc(1); /* will be grown as needed by the realloc above */
head.size = 0; /* no data at this point */
head.download = 0; /* not yet known at this point */
setmainheaders(curl_handle, url);
setrequestheaders(curl_handle, POST);
if(curl_handle) {
/* we pass our 'chunk' struct to the callback function */
curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, parseheader);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, (void *)&head);
if (data == NULL)
curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, post+1);
else curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, data);
if ((res = curl_easy_perform(curl_handle)) != 0) /*error!*/
{
if (data)
curl_formfree(data);
if (res == CURLE_WRITE_ERROR)
{
fillstruct(curl_handle, &head, &h);
free(head.memory);
return h;
}
Debug(curl_easy_strerror((CURLcode)res));
return emptyblock;
}
if (data)
curl_formfree(data);
if(CURLE_OK != curl_easy_getinfo(curl_handle, CURLINFO_CONTENT_TYPE, &ct) || !ct)
return emptyblock;
}
else
return emptyblock;
b.data = chunk.memory;
b.size = chunk.size;
free(head.memory);
findChr(ct, ';');
strcpy(b.type, ct);
return b;
}
开发者ID:Gamer125,项目名称:wiibrowser,代码行数:63,代码来源:httplib.cpp
示例14: main
int main(int argc, char **argv)
{
int c;
int num_threads = 4;
int img = 1;
bool received_all_fragments = false;
bool * received_fragments = calloc(N, sizeof(bool));
while ((c = getopt (argc, argv, "t:i:")) != -1) {
switch (c) {
case 't':
num_threads = strtoul(optarg, NULL, 10);
if (num_threads == 0) {
printf("%s: option requires an argument > 0 -- 't'\n", argv[0]);
return -1;
}
break;
case 'i':
img = strtoul(optarg, NULL, 10);
if (img == 0) {
printf("%s: option requires an argument > 0 -- 'i'\n", argv[0]);
return -1;
}
break;
default:
return -1;
}
}
CURL *curl;
CURLcode res;
png_structp png_ptr;
png_infop info_ptr;
png_byte * output_buffer = calloc(WIDTH*HEIGHT*4, sizeof(png_byte));
curl = curl_easy_init();
if (!curl)
abort_("[main] could not initialize curl");
char * url = malloc(sizeof(char)*strlen(BASE_URL)+4*5);
png_bytep input_buffer = malloc(sizeof(png_byte)*BUF_SIZE);
struct bufdata bd;
bd.buf = input_buffer;
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &bd);
struct headerdata hd; hd.received_fragments = received_fragments;
curl_easy_setopt(curl, CURLOPT_HEADERDATA, &hd);
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_cb);
// request appropriate URL
sprintf(url, BASE_URL, img);
printf("requesting URL %s\n", url);
curl_easy_setopt(curl, CURLOPT_URL, url);
do {
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr)
abort_("[main] png_create_read_struct failed");
// reset input buffer
bd.len = bd.pos = 0; bd.max_size = BUF_SIZE;
// do curl request; check for errors
res = curl_easy_perform(curl);
if(res != CURLE_OK)
abort_("[main] curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
// read PNG (as downloaded from network) and copy it to output buffer
png_bytep* row_pointers = read_png_file(png_ptr, &info_ptr, &bd);
paint_destination(png_ptr, row_pointers, hd.n*BUF_WIDTH, 0, output_buffer);
// free allocated memory
for (int y=0; y<BUF_HEIGHT; y++)
free(row_pointers[y]);
free(row_pointers);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
// check for unreceived fragments
received_all_fragments = true;
for (int i = 0; i < N; i++)
if (!received_fragments[i])
received_all_fragments = false;
} while (!received_all_fragments);
free(url);
free(input_buffer);
curl_easy_cleanup(curl);
// now, write the array back to disk using write_png_file
png_bytep * output_row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * HEIGHT);
for (int i = 0; i < HEIGHT; i++)
output_row_pointers[i] = &output_buffer[i*WIDTH*4];
write_png_file("output.png", output_row_pointers);
free(output_row_pointers);
//.........这里部分代码省略.........
开发者ID:lzljzys,项目名称:OpenGL_OpenMP_Pthread,代码行数:101,代码来源:paster.c
示例15: rlimit
//.........这里部分代码省略.........
return -8;
}
num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN;
for (rl.rlim_cur = 0;
rl.rlim_cur < num_open.rlim_max;
rl.rlim_cur++) {
if (fd[rl.rlim_cur] > num_open.rlim_cur) {
sprintf(strbuff, "select limit is FD_SETSIZE %d", FD_SETSIZE);
store_errmsg(strbuff, 0);
fprintf(stderr, "%s\n", msgbuff);
close_file_descriptors();
free(memchunk);
return -9;
}
}
#endif /* using a FD_SETSIZE bound select() */
/*
* Old or 'backwards compatible' implementations of stdio do not allow
* handling of streams with an underlying file descriptor number greater
* than 255, even when allowing high numbered file descriptors for sockets.
* At this point we have a big number of file descriptors which have been
* opened using dup(), so lets test the stdio implementation and discover
* if it is capable of fopen()ing some additional files.
*/
if (!fopen_works()) {
sprintf(strbuff1, fmt, num_open.rlim_max);
sprintf(strbuff, "stdio fopen() fails with %s fds open()",
strbuff1);
fprintf(stderr, "%s\n", msgbuff);
sprintf(strbuff, "stdio fopen() fails with lots of fds open()");
store_errmsg(strbuff, 0);
close_file_descriptors();
free(memchunk);
return -10;
}
/* free the
|
请发表评论