diff --git a/cache/src/tango_cache_client.cpp b/cache/src/tango_cache_client.cpp index ba64ef2..520ba53 100644 --- a/cache/src/tango_cache_client.cpp +++ b/cache/src/tango_cache_client.cpp @@ -414,7 +414,7 @@ struct tango_cache_ctx *tango_cache_update_prepare(struct tango_cache_instance * if(instance->param->hash_object_key) { caculate_sha256(meta->url, strlen(meta->url), buffer, 72); - snprintf(ctx->object_key, 256, "%s/%c%c:%c%c:%s", instance->param->bucketname, buffer[0], buffer[1], buffer[2], buffer[3], buffer+4); + snprintf(ctx->object_key, 256, "%s/%c%c_%c%c_%s", instance->param->bucketname, buffer[0], buffer[1], buffer[2], buffer[3], buffer+4); //保存原始URL snprintf(buffer, 2064, "x-amz-meta-url: %s", meta->url); ctx->headers = curl_slist_append(ctx->headers, buffer); @@ -600,7 +600,7 @@ struct tango_cache_ctx *tango_cache_fetch_prepare(struct tango_cache_instance *i if(instance->param->hash_object_key) { caculate_sha256(meta->url, strlen(meta->url), sha256, 72); - snprintf(ctx->object_key, 256, "%s/%c%c:%c%c:%s", instance->param->bucketname, sha256[0], sha256[1], sha256[2], sha256[3], sha256+4); + snprintf(ctx->object_key, 256, "%s/%c%c_%c%c_%s", instance->param->bucketname, sha256[0], sha256[1], sha256[2], sha256[3], sha256+4); } else { @@ -670,7 +670,7 @@ struct tango_cache_ctx *tango_cache_delete_prepare(struct tango_cache_instance * if(instance->param->hash_object_key) { caculate_sha256(objkey, strlen(objkey), sha256, 72); - snprintf(ctx->object_key, 256, "%s/%c%c:%c%c:%s", pbucket, sha256[0], sha256[1], sha256[2], sha256[3], sha256+4); + snprintf(ctx->object_key, 256, "%s/%c%c_%c%c_%s", pbucket, sha256[0], sha256[1], sha256[2], sha256[3], sha256+4); } else { diff --git a/cache/src/tango_cache_transfer.cpp b/cache/src/tango_cache_transfer.cpp index 6ea2c63..1b42ce7 100644 --- a/cache/src/tango_cache_transfer.cpp +++ b/cache/src/tango_cache_transfer.cpp @@ -658,7 +658,7 @@ void tango_cache_curl_muldel_done(struct tango_cache_ctx *ctx, CURLcode res, lon int do_tango_cache_multi_delete(struct tango_cache_ctx *ctx, bool callback) { UNUSED CURLMcode rc; - char minio_url[256]; + char minio_url[256], buffer[256]; ctx->instance->statistic.del_recv_num += ctx->del.succ_num; ctx->instance->error_code = CACHE_OK; @@ -674,6 +674,8 @@ int do_tango_cache_multi_delete(struct tango_cache_ctx *ctx, bool callback) curl_easy_setopt(ctx->curl, CURLOPT_POSTFIELDSIZE, ctx->response.size); //填充Content-Length,在CURLOPT_COPYPOSTFIELDS之前设置 curl_easy_setopt(ctx->curl, CURLOPT_COPYPOSTFIELDS, ctx->response.buff); curl_easy_setopt(ctx->curl, CURLOPT_URL, minio_url); + sprintf(buffer, "token: %s", ctx->instance->param->cache_token); + ctx->headers = curl_slist_append(ctx->headers, buffer); curl_easy_setopt(ctx->curl, CURLOPT_HTTPHEADER, ctx->headers); curl_easy_setopt(ctx->curl, CURLOPT_WRITEFUNCTION, curl_response_body_save_cb); curl_easy_setopt(ctx->curl, CURLOPT_WRITEDATA, ctx); diff --git a/cache/src/tango_cache_xml.cpp b/cache/src/tango_cache_xml.cpp index 0d21497..97280b6 100644 --- a/cache/src/tango_cache_xml.cpp +++ b/cache/src/tango_cache_xml.cpp @@ -153,7 +153,7 @@ void construct_multiple_delete_xml(const char *bucket, char *key[], u_int32_t nu { child = xmlNewChild(root, NULL, (const xmlChar*)"Object", NULL); caculate_sha256(key[i], strlen(key[i]), sha256, 72); - snprintf(hashkey, 256, "%c%c/%c%c/%s", sha256[0], sha256[1], sha256[2], sha256[3], sha256+4); + snprintf(hashkey, 256, "%c%c_%c%c_%s", sha256[0], sha256[1], sha256[2], sha256[3], sha256+4); xmlNewChild(child, NULL, (const xmlChar*)"Key", (const xmlChar*)hashkey); } } diff --git a/conf/pangu/pangu_pxy.conf b/conf/pangu/pangu_pxy.conf index f4ea6c6..617d4f8 100644 --- a/conf/pangu/pangu_pxy.conf +++ b/conf/pangu/pangu_pxy.conf @@ -8,8 +8,8 @@ en_sendlog=1 #Addresses of hos, Bucket name in hos. Format is defined by WiredLB. cache_ip_list=10.4.35.42-46; -cache_listen_port=9000 -cache_bucket_name=proxybucket +cache_listen_port=9098 +cache_bucket_name=hos/proxy_hos_bucket cache_token=c21f969b5f03d33d43e04f8f136e7682 #Refer to the pangu_cahche definition