本文整理汇总了C++中curl_easy_reset函数的典型用法代码示例。如果您正苦于以下问题:C++ curl_easy_reset函数的具体用法?C++ curl_easy_reset怎么用?C++ curl_easy_reset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了curl_easy_reset函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: curl_set_handle_opts
static void curl_set_handle_opts(struct dload_payload *payload,
CURL *curl, char *error_buffer)
{
alpm_handle_t *handle = payload->handle;
const char *useragent = getenv("HTTP_USER_AGENT");
struct stat st;
/* the curl_easy handle is initialized with the alpm handle, so we only need
* to reset the handle's parameters for each time it's used. */
curl_easy_reset(curl);
curl_easy_setopt(curl, CURLOPT_URL, payload->fileurl);
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, dload_progress_cb);
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, (void *)payload);
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L);
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L);
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, dload_parseheader_cb);
curl_easy_setopt(curl, CURLOPT_WRITEHEADER, (void *)payload);
curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, dload_sockopt_cb);
curl_easy_setopt(curl, CURLOPT_SOCKOPTDATA, (void *)handle);
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
_alpm_log(handle, ALPM_LOG_DEBUG, "url: %s\n", payload->fileurl);
if(payload->max_size) {
_alpm_log(handle, ALPM_LOG_DEBUG, "maxsize: %jd\n",
(intmax_t)payload->max_size);
curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE,
(curl_off_t)payload->max_size);
}
if(useragent != NULL) {
curl_easy_setopt(curl, CURLOPT_USERAGENT, useragent);
}
if(!payload->allow_resume && !payload->force && payload->destfile_name &&
stat(payload->destfile_name, &st) == 0) {
/* start from scratch, but only download if our local is out of date. */
curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
curl_easy_setopt(curl, CURLOPT_TIMEVALUE, (long)st.st_mtime);
_alpm_log(handle, ALPM_LOG_DEBUG,
"using time condition: %lu\n", (long)st.st_mtime);
} else if(stat(payload->tempfile_name, &st) == 0 && payload->allow_resume) {
/* a previous partial download exists, resume from end of file. */
payload->tempfile_openmode = "ab";
curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, (curl_off_t)st.st_size);
_alpm_log(handle, ALPM_LOG_DEBUG,
"tempfile found, attempting continuation from %jd bytes\n",
(intmax_t)st.st_size);
payload->initial_size = st.st_size;
}
}
开发者ID:7799,项目名称:pacman,代码行数:58,代码来源:dload.c
示例2: ds3_connection_release
void ds3_connection_release(ds3_connection_pool* pool, ds3_connection* connection) {
g_mutex_lock(&pool->mutex);
curl_easy_reset(connection);
pool->tail = _pool_inc(pool, pool->tail);
g_mutex_unlock(&pool->mutex);
g_cond_signal(&pool->available_connections);
}
开发者ID:DenverM80,项目名称:ds3_c_sdk,代码行数:9,代码来源:ds3_connection.c
示例3: _ResetHandle
void
_ResetHandle() {
curl_easy_reset(handle_);
#ifdef DEBUG
curl_easy_setopt(handle_, CURLOPT_VERBOSE, 1L);
#ifdef CRAZY_VERBOSE
curl_easy_setopt(handle_, CURLOPT_DEBUGFUNCTION, _CurlTrace);
#endif
#endif
}
开发者ID:openvstorage,项目名称:volumedriver,代码行数:10,代码来源:curl.hpp
示例4: authRequest
json_t* authRequest(Parameters& params, std::string url, std::string signature, std::string content) {
unsigned char digest[MD5_DIGEST_LENGTH];
MD5((unsigned char*)signature.c_str(), strlen(signature.c_str()), (unsigned char*)&digest);
char mdString[33];
for (int i = 0; i < 16; i++) {
sprintf(&mdString[i*2], "%02X", (unsigned int)digest[i]);
}
std::ostringstream oss;
oss << content << "&sign=" << mdString;
std::string postParameters = oss.str().c_str();
struct curl_slist* headers = NULL;
headers = curl_slist_append(headers, "contentType: application/x-www-form-urlencoded");
CURLcode resCurl;
if (params.curl) {
curl_easy_setopt(params.curl, CURLOPT_POST,1L);
curl_easy_setopt(params.curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(params.curl, CURLOPT_POSTFIELDS, postParameters.c_str());
curl_easy_setopt(params.curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(params.curl, CURLOPT_WRITEFUNCTION, WriteCallback);
std::string readBuffer;
curl_easy_setopt(params.curl, CURLOPT_WRITEDATA, &readBuffer);
curl_easy_setopt(params.curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(params.curl, CURLOPT_CONNECTTIMEOUT, 10L);
resCurl = curl_easy_perform(params.curl);
json_t* root;
json_error_t error;
while (resCurl != CURLE_OK) {
*params.logFile << "<OKCoin> Error with cURL. Retry in 2 sec..." << std::endl;
sleep(4.0);
resCurl = curl_easy_perform(params.curl);
}
root = json_loads(readBuffer.c_str(), 0, &error);
while (!root) {
*params.logFile << "<OKCoin> Error with JSON:\n" << error.text << std::endl;
*params.logFile << "<OKCoin> Buffer:\n" << readBuffer.c_str() << std::endl;
*params.logFile << "<OKCoin> Retrying..." << std::endl;
sleep(4.0);
readBuffer = "";
resCurl = curl_easy_perform(params.curl);
while (resCurl != CURLE_OK) {
*params.logFile << "<OKCoin> Error with cURL. Retry in 2 sec..." << std::endl;
sleep(4.0);
readBuffer = "";
resCurl = curl_easy_perform(params.curl);
}
root = json_loads(readBuffer.c_str(), 0, &error);
}
curl_slist_free_all(headers);
curl_easy_reset(params.curl);
return root;
} else {
*params.logFile << "<OKCoin> Error with cURL init." << std::endl;
return NULL;
}
}
开发者ID:360disrupt,项目名称:blackbird,代码行数:55,代码来源:okcoin.cpp
示例5: qeo_mgmt_curl_util_https_get_with_cb
qeo_mgmt_client_retcode_t qeo_mgmt_curl_util_https_get_with_cb(qeo_mgmt_client_ctx_t *mg_ctx,
const char* url,
char *header,
qeo_mgmt_client_ssl_ctx_cb ssl_cb,
void *ssl_cookie,
curl_write_callback data_cb,
void *write_cookie)
{
curl_ssl_ctx_helper curlsslhelper = { ssl_cb, ssl_cookie };
qeo_mgmt_client_retcode_t ret = QMGMTCLIENT_EFAIL;
const char *cafile = NULL;
const char *capath = NULL;
//Setting CURLOPT_CAINF and PATH is mandatory; otherwise SSL_CTX_FUNCTION will not be called.
curl_opt_helper opts[] = {
{ CURLOPT_SSL_VERIFYHOST, (void*)2 }, /* ensure certificate matches host */
{ CURLOPT_SSL_VERIFYPEER, (void*)0 }, /* ensure certificate is valid */
{ CURLOPT_CAINFO, NULL },
{ CURLOPT_CAPATH, NULL },
{ CURLOPT_SSL_CTX_FUNCTION, (void*)qeo_mgmt_curl_sslctx_cb },
{ CURLOPT_SSL_CTX_DATA, (void*)&curlsslhelper }
};
bool reset = false;
do {
if ((mg_ctx == NULL ) || (mg_ctx->curl_ctx == NULL) || (url == NULL) || (ssl_cb == NULL) || (data_cb == NULL)){
ret = QMGMTCLIENT_EINVAL;
break;
}
if (QEO_UTIL_OK != qeo_platform_get_cacert_path(&cafile, &capath)) {
ret = QMGMTCLIENT_EFAIL;
break;
}
/* insert values into options array */
opts[2].cookie = (void*)cafile;
opts[3].cookie = (void*)capath;
reset = true;
if (CURLE_OK != qeo_mgmt_curl_util_set_opts(opts, sizeof(opts) / sizeof(curl_opt_helper), mg_ctx)) {
ret = QMGMTCLIENT_EINVAL;
break;
}
ret = qeo_mgmt_curl_util_http_get_with_cb(mg_ctx, url, header, data_cb, write_cookie);
reset = false;/* Already done. */
} while (0);
if (reset == true){
/* Make sure we reset all configuration for next calls */
curl_easy_reset(mg_ctx->curl_ctx);
}
if (ret != QMGMTCLIENT_OK) {
qeo_log_w("Failure in https_get_%s",url);
}
return ret;
}
开发者ID:JianlongCao,项目名称:qeo-core,代码行数:55,代码来源:qeo_mgmt_curl_util.c
示例6: return_connection
void return_connection(CURL *curl)
{
curl_easy_reset(curl) ;
pthread_mutex_lock(&pool_mut);
if(curl_pool.free_connect_count >= curl_pool.buffer_connect_count)
curl_easy_cleanup(curl) ;
else
curl_pool.curl_free_connect[(curl_pool.free_connect_count)++] = curl ;
curl_pool.used_connect_count-- ;
pthread_mutex_unlock(&pool_mut);
}
开发者ID:yuehai1117,项目名称:mutli_curl,代码行数:11,代码来源:curl_connect_pool.c
示例7: R_handle_reset
SEXP R_handle_reset(SEXP ptr){
//reset all fields
reference *ref = get_ref(ptr);
set_form(ref, NULL);
set_headers(ref, NULL);
curl_easy_reset(ref->handle);
//restore default settings
set_handle_defaults(ref);
return ScalarLogical(1);
}
开发者ID:RickPack,项目名称:curl,代码行数:11,代码来源:handle.c
示例8: curl_easy_reset
bool curlHttpRequest::Request(const std::string &url, const std::string &request, std::string method, std::string &response, int timeout)
{
m_response_code = 0;
response.clear();
response.reserve(64 * 1024);
curl_easy_reset(m_pcurl);
curl_easy_setopt(m_pcurl, CURLOPT_URL, url.c_str());
curl_easy_setopt(m_pcurl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(m_pcurl, CURLOPT_TIMEOUT, timeout);
curl_easy_setopt(m_pcurl, CURLOPT_WRITEFUNCTION,curlHttpRequest::WriteData);
curl_easy_setopt(m_pcurl, CURLOPT_WRITEDATA, &response);
if(method == "get")
{
curl_easy_setopt(m_pcurl, CURLOPT_HTTPGET, 1);
}
else if(method == "post")
{
curl_easy_setopt(m_pcurl, CURLOPT_POST, 1L);
curl_easy_setopt(m_pcurl, CURLOPT_POSTFIELDSIZE, request.length());
curl_easy_setopt(m_pcurl, CURLOPT_POSTFIELDS, request.c_str());
}
else if(method == "put")
{
curl_easy_setopt(m_pcurl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(m_pcurl, CURLOPT_POSTFIELDSIZE, request.length());
curl_easy_setopt(m_pcurl, CURLOPT_POSTFIELDS, request.c_str());
}
else if(method == "delete")
{
curl_easy_setopt(m_pcurl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
else
{
return false;
}
CURLcode rc = curl_easy_perform(m_pcurl);
if(rc != CURLE_OK)
{
m_error = std::string(curl_easy_strerror(rc));
return false;
}
rc = curl_easy_getinfo(m_pcurl, CURLINFO_RESPONSE_CODE , &m_response_code);
if(rc != CURLE_OK)
{
m_error = std::string(curl_easy_strerror(rc));
return false;
}
return true;
}
开发者ID:Strongc,项目名称:myLib,代码行数:54,代码来源:curlHttpRequest.cpp
示例9: http_reset_request
void http_reset_request (
http_t * http
)
{
if ( unlikely (! http) )
{
return;
}
curl_easy_reset (http->curl);
http_clear_form (http);
}
开发者ID:Qihoo360,项目名称:huststore,代码行数:12,代码来源:http.cpp
示例10: HttpClient_Init
/* 初始化HttpClient,使用前务必调用 */
void HttpClient_Init(HttpClient *client) {
//{{{
curl_version_info_data *version;
if (client->curl == NULL) {
client->curl = curl_easy_init();
client->responseText = HttpBuffer_New();
client->responseHeader = HttpBuffer_New();
} else {
curl_easy_reset(client->curl);
}
/* 重置失败次数 */
client->fail_times = 0;
client->retry_times = 5;
client->retry_interval = 1;
/* 重置失败回调 */
client->fail_reset_callback = NULL;
client->fail_reset_context = NULL;
/* 清空body cstr */
if (client->c_responseText != NULL) {
free(client->c_responseText);
client->c_responseText = NULL;
}
/* 清空header cstr */
if (client->c_responseHeader != NULL) {
free(client->c_responseText);
client->c_responseText = NULL;
}
/* curl 初始化 */
curl_easy_setopt(client->curl, CURLOPT_WRITEFUNCTION, _HttpClient_WriteData);
curl_easy_setopt(client->curl, CURLOPT_WRITEDATA, client);
curl_easy_setopt(client->curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(client->curl, CURLOPT_SSL_VERIFYHOST, 0);
/* 选个快点的加密算法 */
version = curl_version_info(CURLVERSION_NOW);
if (strstr(version->ssl_version, "OpenSSL") != NULL) {
curl_easy_setopt(client->curl, CURLOPT_SSL_CIPHER_LIST, "RC4-SHA");
} else if (strstr(version->ssl_version, "NSS") != NULL) {
curl_easy_setopt(client->curl, CURLOPT_SSL_CIPHER_LIST, "rc4,rsa_rc4_128_sha");
}
/* 设置默认超时时间 */
curl_easy_setopt(client->curl, CURLOPT_TIMEOUT, 20);
curl_easy_setopt(client->curl, CURLOPT_CONNECTTIMEOUT, 5);
}
开发者ID:Johnny-Chen,项目名称:baidu_pcs_cli,代码行数:53,代码来源:http_client.c
示例11: test
int test(char *URL)
{
CURLM *multi;
CURL *easy;
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
return TEST_ERR_MAJOR_BAD;
}
if ((multi = curl_multi_init()) == NULL) {
fprintf(stderr, "curl_multi_init() failed\n");
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD;
}
if ((easy = curl_easy_init()) == NULL) {
fprintf(stderr, "curl_easy_init() failed\n");
curl_multi_cleanup(multi);
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD;
}
curl_multi_setopt(multi, CURLMOPT_PIPELINING, 1);
curl_easy_setopt(easy, CURLOPT_WRITEFUNCTION, fwrite);
curl_easy_setopt(easy, CURLOPT_FAILONERROR, 1);
curl_easy_setopt(easy, CURLOPT_URL, URL);
curl_multi_add_handle(multi, easy);
if (perform(multi) != CURLM_OK)
printf("retrieve 1 failed\n");
curl_multi_remove_handle(multi, easy);
curl_easy_reset(easy);
curl_easy_setopt(easy, CURLOPT_FAILONERROR, 1);
curl_easy_setopt(easy, CURLOPT_URL, arg2);
curl_multi_add_handle(multi, easy);
if (perform(multi) != CURLM_OK)
printf("retrieve 2 failed\n");
curl_multi_remove_handle(multi, easy);
curl_easy_cleanup(easy);
curl_multi_cleanup(multi);
curl_global_cleanup();
printf("Finished!\n");
return 0;
}
开发者ID:blog2i2j,项目名称:greentimer,代码行数:52,代码来源:lib536.c
示例12: curl_context_cleanup
/* ****************************************************************************
*
* curl_context_cleanup -
*/
void curl_context_cleanup(void)
{
for (std::map<std::string, struct curl_context>::iterator it = contexts.begin(); it != contexts.end(); ++it)
{
curl_easy_reset(it->second.curl);
curl_easy_cleanup(it->second.curl);
it->second.curl = NULL;
release_curl_context(&it->second, true);
}
contexts.clear();
curl_global_cleanup();
}
开发者ID:Findeton,项目名称:fiware-orion,代码行数:17,代码来源:sem.cpp
示例13: init
///============================CLEAN BEFORE CLOSING==================================///
void Browser::clean()
{
init();
curl_easy_reset(curl);
history_.clear();
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept:");
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
curl = curl_easy_init();
}
开发者ID:venam,项目名称:alpapap,代码行数:14,代码来源:Browser.hpp
示例14: initFile
/**
* @brief 开始文件下载任务
* @author LuChenQun
* @date 2015/07/05
* @return int 任务结果
*/
int NetWork::startDownloadFile()
{
int code = CURLE_OK;
QByteArray urlBa = m_url.toLocal8Bit();
char *url = urlBa.data();
// 初始化文件
code = initFile();
if (code != NETWORK_INIT_FILE_SUCCESS)
{
return code;
}
curl_easy_reset(m_curl);
curl_easy_setopt(m_curl, CURLOPT_URL, url);
curl_easy_setopt(m_curl, CURLOPT_LOW_SPEED_LIMIT, 10);
curl_easy_setopt(m_curl, CURLOPT_LOW_SPEED_TIME, 300);
curl_easy_setopt(m_curl, CURLOPT_HEADER, 1);
curl_easy_setopt(m_curl, CURLOPT_NOBODY, 1);
// 获取文件大小
code = curl_easy_perform(m_curl);
double fileSize = 0;
curl_easy_getinfo(m_curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fileSize);
emitFileSize(fileSize);
if (getDiskFreeSpace("e:/") <= (m_fileSize))
{
code = NETWORK_DISK_NO_SPACE;
return code;
}
curl_easy_setopt(m_curl, CURLOPT_HEADER, 0);
curl_easy_setopt(m_curl, CURLOPT_NOBODY, 0);
curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, writeData);
curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, this);
curl_easy_setopt(m_curl, CURLOPT_RESUME_FROM_LARGE, m_breakPoint); // 断点续传
curl_easy_setopt(m_curl, CURLOPT_XFERINFOFUNCTION, progress); // 进度
curl_easy_setopt(m_curl, CURLOPT_XFERINFODATA, this);
curl_easy_setopt(m_curl, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(m_curl, CURLOPT_NOSIGNAL, 1L); // 多线程需要注意的
curl_easy_setopt(m_curl, CURLOPT_FORBID_REUSE, 1);
code = curl_easy_perform(m_curl);
m_downloadFile.flush();
m_downloadFile.close();
return code;
}
开发者ID:luchenqun,项目名称:MyDoubanFM,代码行数:57,代码来源:NetWork.cpp
示例15: request_deinitialize
static void request_deinitialize(Request *request)
{
if (request->headers) {
curl_slist_free_all(request->headers);
}
error_parser_deinitialize(&(request->errorParser));
// curl_easy_reset prevents connections from being re-used for some
// reason. This makes HTTP Keep-Alive meaningless and is very bad for
// performance. But it is necessary to allow curl to work properly.
// xxx todo figure out why
curl_easy_reset(request->curl);
}
开发者ID:hjiawei,项目名称:libs3,代码行数:14,代码来源:request.c
示例16: Qiniu_Client_reset
CURL* Qiniu_Client_reset(Qiniu_Client* self)
{
CURL* curl = (CURL*)self->curl;
curl_easy_reset(curl);
Qiniu_Buffer_Reset(&self->b);
Qiniu_Buffer_Reset(&self->respHeader);
if (self->root != NULL) {
cJSON_Delete(self->root);
self->root = NULL;
}
return curl;
}
开发者ID:BluntBlade,项目名称:tmp_c_sdk,代码行数:14,代码来源:http.c
示例17: dcontext_prepare
int
dcontext_prepare(struct dcontext *dctx)
{
sassert(dctx);
sassert(dctx->d_savefile);
CURL *c = dctx->d_handle = curl_easy_init();
curl_easy_reset(c);
curl_easy_setopt(c, CURLOPT_FAILONERROR, 1L);
curl_easy_setopt(c, CURLOPT_CONNECTTIMEOUT, 10L);
curl_easy_setopt(c, CURLOPT_FILETIME, 1L);
curl_easy_setopt(c, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(c, CURLOPT_LOW_SPEED_LIMIT, 1024L);
curl_easy_setopt(c, CURLOPT_LOW_SPEED_TIME, 10L);
curl_easy_setopt(c, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
curl_easy_setopt(c, CURLOPT_URL, dctx->d_url);
curl_easy_setopt(c, CURLOPT_ERRORBUFFER, &dctx->d_ebuffer[0]);
/* no progress for now */
curl_easy_setopt(c, CURLOPT_NOPROGRESS, 1L);
#if 0
curl_easy_setopt(c, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(c, CURLOPT_PROGRESSFUNCTION, dcontext_progress_func);
curl_easy_setopt(c, CURLOPT_PROGRESSDATA, dctx);
#endif
/* no header function for now */
#if 0
curl_easy_setopt(c, CURLOPT_HEADERFUNCTION, dcontext_header_func);
curl_easy_setopt(c, CURLOPT_WRITEHEADER, dctx);
#endif
if ((dctx->d_savefp = fopen(dctx->d_savefile, "wb")) == NULL) {
goto error;
}
curl_easy_setopt(c, CURLOPT_WRITEDATA, dctx->d_savefp);
return 0;
error:
fprintf(stderr, "failed: %s\n", strerror(errno));
return -1;
}
开发者ID:yami,项目名称:pacfind,代码行数:50,代码来源:download.c
示例18: CompleteMultipartUpload
/**
* Complete a multipart upload.
* @param s3Comm [in] S3COMM handle.
* @param curl [in] CURL handle for the current transfer.
* @param fileId [in] Upload ID for the multipart uploads.
* @param parts [in] Number of parts in the multipart upload.
* @param hostname [in] Host name for the S3 request.
* @param filepath [in] Remote file path of the file.
* @param uploadId [in] Upload ID for the multipart upload.
* @return Nothing.
*/
STATIC void
CompleteMultipartUpload(
S3COMM *s3Comm,
CURL *curl,
sqlite3_int64 fileId,
int parts,
const char *hostname,
const char *filepath,
const char *uploadId
)
{
struct curl_slist *headers;
int i;
char *url;
FILE *upFile;
const char *etag;
int status;
/* Build the parts list. */
if( Query_AllPartsUploaded( fileId ) )
{
upFile = tmpfile( );
fputs( "<CompleteMultipartUpload>\n", upFile );
for( i = 1; i < parts + 1; i++ )
{
etag = Query_GetPartETag( fileId, i );
fprintf( upFile, "<Part><PartNumber>%d</PartNumber>"
"<ETag>%s</ETag></Part>\n", i, etag );
}
fputs( "</CompleteMultipartUpload>\n", upFile );
/* Upload the parts list. */
url = malloc( strlen( filepath )
+ strlen( "?uploadId=" )
+ strlen( uploadId ) + sizeof( char ) );
headers = BuildS3Request( s3Comm, "POST", hostname, NULL, url );
curl_easy_reset( curl );
curl_easy_setopt( curl, CURLOPT_READDATA, upFile );
curl_easy_setopt( curl, CURLOPT_HTTPHEADER, headers );
curl_easy_setopt( curl, CURLOPT_URL, url );
status = curl_easy_perform( curl );
if( status != 0 )
{
fprintf( stderr, "Could not complete multipart upload.\n" );
}
DeleteCurlSlistAndContents( headers );
fclose( upFile );
}
}
开发者ID:behnam,项目名称:aws-s3fs,代码行数:60,代码来源:downloadqueue.c
示例19: curl_easy_reset
void CURLSession::setup(const Request & request) {
if(!m_curl) {
return;
}
curl_easy_reset(m_curl);
curl_easy_setopt(m_curl, CURLOPT_URL, request.url().c_str());
curl_easy_setopt(m_curl, CURLOPT_FOLLOWLOCATION, request.followRedirects() ? 1L : 0L);
curl_easy_setopt(m_curl, CURLOPT_USERAGENT, m_userAgent.c_str());
curl_easy_setopt(m_curl, CURLOPT_NOPROGRESS, 1L);
}
开发者ID:Dimoks,项目名称:ArxLibertatis_fork,代码行数:16,代码来源:HTTPClientCURL.cpp
示例20: QBox_Client_initcall
static void QBox_Client_initcall(QBox_Client* self, const char* url)
{
CURL* curl = (CURL*)self->curl;
curl_easy_reset(curl);
QBox_Buffer_Reset(&self->b);
if (self->root != NULL) {
cJSON_Delete(self->root);
self->root = NULL;
}
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(curl, CURLOPT_URL, url);
}
开发者ID:hantuo,项目名称:c-sdk,代码行数:16,代码来源:oauth2.c
注:本文中的curl_easy_reset函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论