支持以业务为单位,配置文件不持久化到本地
This commit is contained in:
@@ -153,6 +153,46 @@ void doris_http_ctx_add_header_kvint(struct doris_http_ctx *ctx, const char *hea
|
||||
ctx->headers = curl_slist_append(ctx->headers, header);
|
||||
}
|
||||
|
||||
int doris_http_launch_head_request(struct doris_http_ctx *ctx, const char *uri)
|
||||
{
|
||||
char minio_url[2048];
|
||||
|
||||
assert(ctx->curl == NULL);
|
||||
if(NULL == (ctx->curl=curl_easy_init()))
|
||||
{
|
||||
assert(0);return -1;
|
||||
}
|
||||
|
||||
curl_easy_setopt(ctx->curl, CURLOPT_NOBODY, 1L); //HEAD<41><44><EFBFBD><EFBFBD>
|
||||
if(ctx->instance->param->ssl_connection)
|
||||
{
|
||||
snprintf(minio_url, sizeof(minio_url), "https://%s/%s", ctx->multidata->host->srvaddr, uri);
|
||||
curl_easy_setopt(ctx->curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
curl_easy_setopt(ctx->curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(minio_url, sizeof(minio_url), "http://%s/%s", ctx->multidata->host->srvaddr, uri);
|
||||
}
|
||||
curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url);
|
||||
|
||||
if(ctx->headers != NULL)
|
||||
{
|
||||
curl_easy_setopt(ctx->curl, CURLOPT_HTTPHEADER, ctx->headers);
|
||||
}
|
||||
curl_easy_setopt(ctx->curl, CURLOPT_HEADERFUNCTION, curl_response_header_cb);
|
||||
curl_easy_setopt(ctx->curl, CURLOPT_HEADERDATA, ctx);
|
||||
curl_easy_setopt(ctx->curl, CURLOPT_PRIVATE, ctx);
|
||||
curl_set_common_options(ctx->curl, ctx->instance->param->transfer_timeout, ctx->error);
|
||||
|
||||
if(CURLM_OK != curl_multi_add_handle(ctx->multidata->multi_hd, ctx->curl))
|
||||
{
|
||||
assert(0); return -2;
|
||||
}
|
||||
ctx->transfering = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int doris_http_launch_get_request(struct doris_http_ctx *ctx, const char *uri)
|
||||
{
|
||||
char minio_url[2048];
|
||||
|
||||
Reference in New Issue
Block a user