Giter VIP home page Giter VIP logo

aliyun-oss-c-sdk's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aliyun-oss-c-sdk's Issues

编译OSS错误 apr1.5.2

Linking C static library build/Release/lib/liboss_c_sdk_static.a
[ 47%] Built target oss_c_sdk_static
[ 48%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_sample_util.o
[ 50%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_config.o
[ 51%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/main.o
[ 52%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_put_object_sample.o
[ 53%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_append_object_sample.o
[ 55%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_get_object_sample.o
[ 56%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_head_object_sample.o
[ 57%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_delete_object_sample.o
[ 59%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_multipart_upload_sample.o
[ 60%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_crc_sample.o
[ 61%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_image_sample.o
[ 63%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_progress_sample.o
[ 64%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_callback_sample.o
[ 65%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_list_object_sample.o
[ 67%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_resumable_sample.o
[ 68%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_get_object_meta_sample.o
[ 69%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_put_object_acl_sample.o
[ 71%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_get_object_acl_sample.o
[ 72%] Building C object oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/oss_select_object_sample.o
Linking C executable ../build/Release/bin/oss_c_sdk_sample
/home/cheng/work/shc_gw1230/bu/local/lib/libapr-1.a(apr_snprintf.o): In function `apr_cvt':
strings/apr_snprintf.c:(.text+0x158): undefined reference to `modf'
strings/apr_snprintf.c:(.text+0x1e4): undefined reference to `modf'
strings/apr_snprintf.c:(.text+0x32c): undefined reference to `modf'
collect2: error: ld returned 1 exit status
make[2]: *** [build/Release/bin/oss_c_sdk_sample] Error 1
make[1]: *** [oss_c_sdk_sample/CMakeFiles/oss_c_sdk_sample.dir/all] Error 2
make: *** [all] Error 2

apr make install ok, but build oss then pop error.

上传文件的md5怎么用

文件上传是调用oss_append_object_from_file, 怎么把md5用起来?是放在Content-MD5还是调用后从resp_headers读md5跟本地文件的md5比较?有Demo吗?
aos_table_t *resp_headers使用后怎么释放?

oss_head_object()当object不存在时,没有一个明确的错误

调用oss_head_object(),当object不存在的时候,返回的status如下:

req_id: 56DCFA06DA14FDFF1BC21924
error_code: "UnkonwnError"
error_msg: ""

这里面有两个问题:

  1. 这个error code反映不了到底这个请求是因为什么原因失败
  2. error code有一处typo,应该是UnknownError

android build

Do you have a script to build oss-c-sdk targeting android and ios?

上传图片超时 Timeout was reached ?

这种情况 该如何处理? 需要怎样设置 超时时长? aliyun-oss-c-sdk-3.5.0/oss_c_sdk/aos_transport.c:456 transport failure curl code:28 error:Timeout was reached

request_release not reset request before add to requestStackG

when call aos_request_get, request will be reset to init status.
If we reset request before add to requestStackG, we can release unneed memory.

// related codes:

CURL *aos_request_get()
{
CURL *request = NULL;

apr_thread_mutex_lock(requestStackMutexG);
if (requestStackCountG > 0) {
    request = requestStackG[--requestStackCountG];
}
apr_thread_mutex_unlock(requestStackMutexG);

// If we got one, deinitialize it for re-use
if (request) {
    curl_easy_reset(request);
}
else {
    request = curl_easy_init();
}

return request;

}

void request_release(CURL *request)
{
apr_thread_mutex_lock(requestStackMutexG);

// If the request stack is full, destroy this one
// else put this one at the front of the request stack; we do this because
// we want the most-recently-used curl handle to be re-used on the next
// request, to maximize our chances of re-using a TCP connection before it
// times out
if (requestStackCountG == AOS_REQUEST_STACK_SIZE) {
    apr_thread_mutex_unlock(requestStackMutexG);
    curl_easy_cleanup(request);
}
else {
    requestStackG[requestStackCountG++] = request;
    apr_thread_mutex_unlock(requestStackMutexG);
}

}

sdk发送的http请求同时带有Transfer-Encoding和Content-Length,导致被nginx拦截

image 如图,到底是要用分块还是非分块解析呢?因为Transfer-Encoding和Content-Length同时存在,故而会被nginx识别为错误请求而拦截掉。

如下:

2023/10/10 10:54:24 [info] 64531#64531: *147915334 client sent "Content-Length" and "Transfer-Encoding" headers at the same time while reading client request headers, client: 10.16.64.20, server: *.xxxx.com, request: "PUT /aaaaaaa/bbb HTTP/1.1", host: "oss.xxx.com"

aos_should_retry 重试 BUG

调用 OSS C API oss_get_object_to_buffer 出错

struct aos_status_s {
int code; // > 0 http code
char *error_code; // can't modify
char *error_msg; // can't modify
char *req_id; // can't modify
};

aos_status_s 结构反馈的错误信息:

code -992
error_code HttpIoError
error_msg Timeout
req_id 58EC0CD00731DD416E838728

aos_should_retry 函数的判断是否有BUG
应该判断 int code 的值,而不是判断 error_code

安装失败:错误:提领指向不完全类型的指针

[ 1%] Building C object CMakeFiles/oss_c_sdk.dir/oss_c_sdk/aos_status.o
/root/dbadir/20210329/aliyun-oss-c-sdk-3.5.0/oss_c_sdk/aos_status.c: 在函数‘aos_should_retry’中:
/root/dbadir/20210329/aliyun-oss-c-sdk-3.5.0/oss_c_sdk/aos_status.c:34:9: 警告:未使用的变量‘aos_error_code’ [-Wunused-variable]
int aos_error_code = 0;
^
/root/dbadir/20210329/aliyun-oss-c-sdk-3.5.0/oss_c_sdk/aos_status.c: 在函数‘aos_status_parse_from_body’中:
/root/dbadir/20210329/aliyun-oss-c-sdk-3.5.0/oss_c_sdk/aos_status.c:95:33: 错误:提领指向不完全类型的指针
node_content = code_node->child->value.opaque;
^
/root/dbadir/20210329/aliyun-oss-c-sdk-3.5.0/oss_c_sdk/aos_status.c:101:36: 错误:提领指向不完全类型的指针
node_content = message_node->child->value.opaque;
^
make[2]: *** [CMakeFiles/oss_c_sdk.dir/oss_c_sdk/aos_status.o] 错误 1
make[1]: *** [CMakeFiles/oss_c_sdk.dir/all] 错误 2
make: *** [all] 错误 2

上传下载的进度回掉函数对多线程的支持

从官网上下载的c sdk 3.5 for windows,调用oss_resumable_upload_file或者oss_resumable_download_file接口时,传入的回掉函数只有2个参数分别表示已经处理的和全部的数据量。这种在多线程调用的时候,怎么区分哪个进度是哪个正在进行中的任务呢?

启动了断点续传为什么还是每次从头开始下载文件

	aos_string_t object;
	int is_cname = 0;
	oss_request_options_t *options = NULL;
	aos_table_t *params = NULL;
	aos_table_t *resp_headers = NULL;
	aos_table_t *headers = NULL;
	aos_status_t *s = NULL;
	aos_string_t file;
	aos_pool_t *p = NULL;
	aos_string_t bucket;

	aos_pool_create(&p, NULL);
	options = oss_request_options_create(p);
	initRequestOptions(options, is_cname);

	headers = aos_table_make(p, 0);

	aos_str_set(&bucket, bucketName.c_str());
	aos_str_set(&object, objectName.c_str());
	aos_str_set(&file, filePath.c_str());

	if (resumable)
	{
		oss_resumable_clt_params_t *clt_params;

		clt_params = oss_create_resumable_clt_params_content(p, partSize, threadNum, AOS_TRUE, 0);

		s = oss_resumable_download_file(options, &bucket, &object, &file, headers, 0,
			clt_params, downloadCallback, &resp_headers);
	}
	else
	{
		s = oss_do_get_object_to_file(options, &bucket, &object, headers, 0,
			&file, downloadCallback, 0);
	}

我上面的断点续传没写错吧。为什么会从头开始下载文件呢,我看了你的demo写的。哪里写错了吗

oss_resumable.h missed in INSTALL part of CMakeLists.txt

Hi, after i installed latest oss c sdk, i found oss_resumable.h is not installed into /usr/local/include, which could cause my program fail to compile.

Then I checked the CMakeLists.txt , i found oss_resumable.h missed in INSTALL part, please add it

Windows MinGW编译问题

编译后出现这样的一句话怎么解决:
C:/Windows/System32/libcurl.dll: file not recognized: file format not recognized

oss_get_sorted_uploaded_part函数存在内存溢出

    oss_upload_part_t *part_arr = NULL;
... ...
    // 这里存在溢出,应该为sizeof(oss_upload_part_t)。
    part_arr = aos_palloc(parent_pool, OSS_MAX_PART_NUM * sizeof(oss_upload_part_t *)); 
... ...
            oss_upload_part_t upload_part;
            part_arr[part_index++] = upload_part;

不支持长连接

上传采用curl没有启用CURLOPT_TCP_KEEPALIVE,会导致应用占用大量端口

centos编译时报错

按照官网教程,在centos7环境下安装完依赖:

yum install cmake
yum install curl-devel apr-devel apr-util-devel  mxml mxml-devel

安装依赖如下:
image
下载oss sdk 3.10.0后,cmake . 前未出现错误,make时报了如下错误:
image

共用一个TCP连接,发送Content-Length为0的PUT请求和其他请求时,PUT的后一个请求无法正常处理

aliyun-oss-c-sdk版本:3.6.0
libcurl版本:7.63.0
问题:当我用aos_http_io_initialize()初始化网络和其他资源后,先后发起一个Content-Length为0的PUT请求(比如设置bucket的ACL)和一个GET请求,毋庸置疑,这两个HTTP请求会共用同一条TCP连接。发送第一个PUT请求时,虽然设置了”Content-Length:0“,并没有主动设置“Transfer-Encoding:chunked”(我查阅了代码),但是在发送的包里还是发现了“Transfer-Encoding:chunked”这个header,这导致服务器端忽略了Content-length,从而不能正确区分两个HTTP请求的边界,导致第二个请求失败。(当PUT请求的Content-length不为0时(比如分块上传),并没有发现“Transfer-Encoding”header)。

解决:我查阅了libcurl官方文档,发现对于“Transfer-Encoding”有这样的描述:

Enforcing chunked transfer-encoding
By making sure a request uses the custom header "Transfer-Encoding: chunked" when doing a non-GET HTTP operation, libcurl will switch over to "chunked" upload, even though the size of the data to upload might be known. By default, libcurl usually switches over to chunked upload automatically if the upload data size is unknown.

对于PUT请求,有这样的描述:

A parameter set to 1 tells the library to use HTTP PUT to transfer data. The data should be set with CURLOPT_READDATA and CURLOPT_INFILESIZE.

因此我在aos_transport.c的aos_curl_transport_setup()函数中添加了一句:

switch (t->req->method) {
        case HTTP_HEAD:
            curl_easy_setopt_safe(CURLOPT_NOBODY, 1);
            break;
        case HTTP_PUT:
            curl_easy_setopt_safe(CURLOPT_UPLOAD, 1);
            /* modify here */
            curl_easy_setopt_safe(CURLOPT_INFILESIZE, t->req->body_len);
            break;
        case HTTP_POST:
            curl_easy_setopt_safe(CURLOPT_POST, 1);
            break;
        case HTTP_DELETE:
            curl_easy_setopt_safe(CURLOPT_CUSTOMREQUEST, "DELETE");
            break;
        default: // HTTP_GET
            break;
    }

现在它正常工作了,我觉得需要报告一下。

编译失败 dereferencing pointer to incomplete type ‘mxml_node_t {aka struct _mxml_node_s}

~/oss_c_sdk/aliyun-oss-c-sdk-3.5.0$ make Scanning dependencies of target oss_c_sdk_static [ 1%] Building C object CMakeFiles/oss_c_sdk_static.dir/oss_c_sdk/aos_status.o oss_c_sdk/aliyun-oss-c-sdk-3.5.0/oss_c_sdk/aos_status.c: In function ‘aos_should_retry’: oss_c_sdk/aliyun-oss-c-sdk-3.5.0/oss_c_sdk/aos_status.c:34:9: warning: unused variable ‘aos_error_code’ [-Wunused-variable] int aos_error_code = 0; ^~~~~~~~~~~~~~ oss_c_sdk/aliyun-oss-c-sdk-3.5.0/oss_c_sdk/aos_status.c: In function ‘aos_status_parse_from_body’: **oss_c_sdk/aliyun-oss-c-sdk-3.5.0/oss_c_sdk/aos_status.c:95:26: error: dereferencing pointer to incomplete type ‘mxml_node_t {aka struct _mxml_node_s}’ node_content = code_node->child->value.opaque; ^~** CMakeFiles/oss_c_sdk_static.dir/build.make:182: recipe for target 'CMakeFiles/oss_c_sdk_static.dir/oss_c_sdk/aos_status.o' failed make[2]: *** [CMakeFiles/oss_c_sdk_static.dir/oss_c_sdk/aos_status.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/oss_c_sdk_static.dir/all' failed make[1]: *** [CMakeFiles/oss_c_sdk_static.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

版本如下:
apr-1.7.0
apr-util-1.6.1
mxml-3.1

上传本地文件到OSS,API提供问题

void put_object_from_file() 实现上传本地文件到OSS介绍中描述:
通过oss_put_object_from_file接口,并指定fliepath参数,可以实现上传一个本地文件到OSS。

实际上,api提供的oss_put_object_from_file接口,并没有这个path参数,该如何解决。

[问题描述在:官方问题描述链接
问题代码在:aliyun-oss-c-sdk / oss_c_sdk_sample / oss_put_object_sample.c

斷點續傳不支持proxy

參考鏈接 https://help.aliyun.com/document_detail/90219.html?spm=a2c4g.11186623.6.1137.7fd42989fIdVD0 和 oss_c_sdk_test代碼,當設置 proxy 選項時:

void init_options(oss_request_options_t *options)
{
    options->config = oss_config_create(options->pool);

    /* 用char*类型的字符串初始化aos_string_t类型。*/
    aos_str_set(&options->config->endpoint, endpoint);
    aos_str_set(&options->config->access_key_id, access_key_id);
    aos_str_set(&options->config->access_key_secret, access_key_secret);
    aos_str_set(&options->config->proxy_host, proxy_host);
    aos_str_set(&options->config->proxy_user, proxy_user);
    aos_str_set(&options->config->proxy_passwd, proxy_passwd);
    options->config->proxy_port = atoi(proxy_port);

    /* 是否使用了CNAME。0表示不使用。*/
    options->config->is_cname = 0;
    /* 设置网络相关参数,比如超时时间等。*/
    options->ctl = aos_http_controller_create(options->pool, 0);
    options->ctl->options = aos_http_request_options_create(options->pool);
    oss_config_resolve(options->pool, options->config, options->ctl);
    options->ctl->options->verify_ssl = AOS_FALSE;
}

調用斷點續傳 api:

    /* 断点续传。*/
    clt_params = oss_create_resumable_clt_params_content(pool, 1024 * 100, 3, AOS_TRUE, NULL);
    resp_status = oss_resumable_upload_file(oss_client_options, &bucket, &object, &file, headers, NULL, clt_params, NULL, &resp_headers, &resp_body);

將出現以下錯誤

aliyun-oss-c-sdk/oss_c_sdk/aos_transport.c:497 transport failure curl code:28 error:Timeout was reached
resumable upload failed

簡單看了下源代碼,猜測可能是沒有將 proxy 相關選項傳遞給 checkpoint content 的定義中。

OSS C SDK 在mac上面make失败

Undefined symbols for architecture x86_64:
"_apr_array_make", referenced from:
_aos_fstack_create in aos_fstack.o
"_apr_array_pop", referenced from:
_aos_fstack_pop in aos_fstack.o
"_apr_array_push", referenced from:
_aos_fstack_push in aos_fstack.o
"_apr_atomic_inc32", referenced from:
_upload_part in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
_oss_resumable_download_file_internal in oss_resumable.o
"_apr_atomic_read32", referenced from:
_upload_part in oss_resumable.o
_oss_resumable_upload_file_without_cp in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
_download_part_thread in oss_resumable.o
_oss_resumable_download_file_internal in oss_resumable.o
"_apr_file_close", referenced from:
_aos_open_file_for_read in aos_buf.o
_aos_http_io_deinitialize in aos_http_io.o
_aos_transport_cleanup in aos_transport.o
_oss_get_file_info in oss_resumable.o
_oss_does_file_exist in oss_resumable.o
_oss_load_checkpoint in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
...
"_apr_file_flush", referenced from:
_oss_dump_checkpoint in oss_resumable.o
"_apr_file_info_get", referenced from:
_aos_open_file_for_read in aos_buf.o
_oss_get_file_info in oss_resumable.o
_oss_load_checkpoint in oss_resumable.o
"_apr_file_open", referenced from:
_aos_open_file_for_read in aos_buf.o
_aos_open_file_for_write in aos_buf.o
_aos_open_file_for_write_notrunc in aos_buf.o
_oss_get_file_info in oss_resumable.o
_oss_does_file_exist in oss_resumable.o
_oss_open_checkpoint_file in oss_resumable.o
_oss_load_checkpoint in oss_resumable.o
...
"_apr_file_read", referenced from:
_aos_read_http_body_file in aos_http_io.o
"_apr_file_read_full", referenced from:
_oss_load_checkpoint in oss_resumable.o
"_apr_file_remove", referenced from:
_oss_resumable_upload_file_with_cp in oss_resumable.o
_oss_resumable_download_file_internal in oss_resumable.o
_oss_temp_file_rename in oss_util.o
"_apr_file_rename", referenced from:
_oss_resumable_download_file_internal in oss_resumable.o
_oss_temp_file_rename in oss_util.o
"_apr_file_seek", referenced from:
_aos_open_file_for_range_read in aos_buf.o
_download_part in oss_resumable.o
"_apr_file_trunc", referenced from:
_oss_dump_checkpoint in oss_resumable.o
_oss_resumable_download_file_internal in oss_resumable.o
"_apr_file_write", referenced from:
_aos_write_http_body_file in aos_http_io.o
_aos_log_print_default in aos_log.o
_oss_dump_checkpoint in oss_resumable.o
"_apr_initialize", referenced from:
_aos_http_io_initialize in aos_http_io.o
"_apr_is_empty_table", referenced from:
_aos_query_params_to_string in aos_util.o
_oss_get_canonicalized_headers in oss_auth.o
_oss_get_canonicalized_resource in oss_auth.o
_oss_get_canonicalized_params in oss_auth.o
"_apr_md5_final", referenced from:
_aos_md5 in aos_util.o
"_apr_md5_init", referenced from:
_aos_md5 in aos_util.o
"_apr_md5_update", referenced from:
_aos_md5 in aos_util.o
"_apr_os_thread_current", referenced from:
_aos_log_format_default in aos_log.o
"_apr_palloc", referenced from:
_aos_create_buf in aos_buf.o
_aos_buf_pack in aos_buf.o
_aos_buf_list_content in aos_buf.o
_aos_create_file_buf in aos_buf.o
_aos_buf_append_string in aos_buf.o
_aos_http_request_options_create in aos_http_io.o
_aos_http_controller_create in aos_http_io.o
...
"_apr_pool_create_ex", referenced from:
_aos_http_controller_create in aos_http_io.o
_aos_http_io_initialize in aos_http_io.o
_oss_delete_objects_by_prefix in oss_bucket.o
_oss_get_sorted_uploaded_part in oss_multipart.o
_oss_upload_file in oss_multipart.o
_oss_build_thread_params in oss_resumable.o
_oss_resumable_upload_file_without_cp in oss_resumable.o
...
"_apr_pool_destroy", referenced from:
_aos_http_io_deinitialize in aos_http_io.o
_oss_delete_objects_by_prefix in oss_bucket.o
_oss_get_sorted_uploaded_part in oss_multipart.o
_oss_upload_file in oss_multipart.o
_oss_destroy_thread_pool in oss_resumable.o
_oss_resumable_upload_file_without_cp in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
...
"_apr_psprintf", referenced from:
_aos_curl_default_write_callback in aos_transport.o
_aos_init_curl_headers in aos_transport.o
_aos_init_curl_url in aos_transport.o
_oss_sign_headers in oss_auth.o
_get_oss_request_signature in oss_auth.o
_oss_get_signed_url in oss_auth.o
_oss_get_rtmp_signed_url in oss_auth.o
...
"_apr_pstrdup", referenced from:
_aos_status_dup in aos_status.o
_aos_status_parse_from_body in aos_status.o
_aos_curl_http_transport_perform in aos_transport.o
_aos_curl_transport_setup in aos_transport.o
_aos_curl_transport_headers_done in aos_transport.o
_oss_delete_objects_by_prefix in oss_bucket.o
_oss_upload_file in oss_multipart.o
...
"_apr_pstrndup", referenced from:
_aos_pstrdup in aos_string.o
"_apr_queue_create", referenced from:
_oss_resumable_upload_file_without_cp in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
_oss_resumable_download_file_internal in oss_resumable.o
"_apr_queue_pop", referenced from:
_oss_resumable_upload_file_without_cp in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
_oss_resumable_download_file_internal in oss_resumable.o
"_apr_queue_push", referenced from:
_upload_part in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
_download_part_thread in oss_resumable.o
_oss_resumable_download_file_internal in oss_resumable.o
"_apr_queue_size", referenced from:
_oss_resumable_download_file_internal in oss_resumable.o
"_apr_queue_trypop", referenced from:
_oss_resumable_upload_file_without_cp in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
_download_part_thread in oss_resumable.o
"_apr_sha1_final", referenced from:
_HMAC_SHA1 in aos_util.o
"_apr_sha1_init", referenced from:
_HMAC_SHA1 in aos_util.o
"_apr_sha1_update", referenced from:
_HMAC_SHA1 in aos_util.o
"_apr_sleep", referenced from:
_oss_resumable_upload_file_without_cp in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
"_apr_snprintf", referenced from:
_aos_http_io_initialize in aos_http_io.o
_aos_log_format_default in aos_log.o
_aos_convert_to_gmt_time in aos_util.o
_aos_query_params_to_string in aos_util.o
_oss_get_canonicalized_headers in oss_auth.o
_oss_get_canonicalized_resource in oss_auth.o
_oss_sign_request in oss_auth.o
...
"_apr_stat", referenced from:
_oss_resumable_download_file_internal in oss_resumable.o
"_apr_strerror", referenced from:
_aos_open_file_for_read in aos_buf.o
_aos_open_file_for_write in aos_buf.o
_aos_open_file_for_write_notrunc in aos_buf.o
_aos_read_http_body_file in aos_http_io.o
_aos_write_http_body_file in aos_http_io.o
_aos_http_io_initialize in aos_http_io.o
_aos_transport_cleanup in aos_transport.o
...
"_apr_strnatcasecmp", referenced from:
_aos_gnome_sort in aos_util.o
"_apr_strnatcmp", referenced from:
_is_oss_sub_resource in oss_auth.o
"_apr_table_add", referenced from:
_oss_put_bucket_acl in oss_bucket.o
_oss_get_bucket_acl in oss_bucket.o
_oss_get_bucket_location in oss_bucket.o
_oss_get_bucket_info in oss_bucket.o
_oss_get_bucket_stat in oss_bucket.o
_oss_get_bucket_referer in oss_bucket.o
_oss_get_bucket_storage_capacity in oss_bucket.o
...
"_apr_table_addn", referenced from:
_aos_curl_response_headers_parse in aos_transport.o
_oss_sign_headers in oss_auth.o
_oss_put_bucket_storage_capacity in oss_bucket.o
_oss_delete_objects in oss_bucket.o
"_apr_table_elts", referenced from:
_aos_init_curl_headers in aos_transport.o
_aos_query_params_to_string in aos_util.o
_oss_get_canonicalized_headers in oss_auth.o
_oss_get_canonicalized_resource in oss_auth.o
_oss_get_rtmp_signed_url in oss_auth.o
_oss_get_canonicalized_params in oss_auth.o
"_apr_table_get", referenced from:
_aos_curl_transport_headers_done in aos_transport.o
_oss_get_string_to_sign in oss_auth.o
_oss_get_canonicalized_headers in oss_auth.o
_oss_get_canonicalized_resource in oss_auth.o
_oss_sign_request in oss_auth.o
_oss_get_canonicalized_params in oss_auth.o
_oss_upload_file in oss_multipart.o
...
"_apr_table_make", referenced from:
_aos_http_request_create in aos_http_io.o
_aos_http_response_create in aos_http_io.o
_oss_upload_file in oss_multipart.o
_oss_put_symlink in oss_object.o
_oss_resumable_upload_file_without_cp in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
_aos_table_create_if_null in oss_util.o
...
"_apr_table_set", referenced from:
_oss_sign_request in oss_auth.o
_get_oss_request_signature in oss_auth.o
_oss_get_signed_url in oss_auth.o
_oss_get_rtmp_signed_url in oss_auth.o
_oss_create_bucket_with_params in oss_bucket.o
_oss_put_bucket_acl in oss_bucket.o
_oss_delete_objects in oss_bucket.o
...
"_apr_terminate", referenced from:
_aos_http_io_deinitialize in aos_http_io.o
"_apr_thread_create", referenced from:
_oss_resumable_download_file_internal in oss_resumable.o
"_apr_thread_join", referenced from:
_oss_resumable_download_file_internal in oss_resumable.o
"_apr_thread_mutex_create", referenced from:
_aos_http_io_initialize in aos_http_io.o
"_apr_thread_mutex_destroy", referenced from:
_aos_http_io_deinitialize in aos_http_io.o
"_apr_thread_mutex_lock", referenced from:
_aos_request_get in aos_http_io.o
_request_release in aos_http_io.o
"_apr_thread_mutex_unlock", referenced from:
_aos_request_get in aos_http_io.o
_request_release in aos_http_io.o
"_apr_thread_pool_create", referenced from:
_oss_resumable_upload_file_without_cp in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
"_apr_thread_pool_push", referenced from:
_oss_resumable_upload_file_without_cp in oss_resumable.o
_oss_resumable_upload_file_with_cp in oss_resumable.o
"_apr_time_exp_gmt", referenced from:
_aos_get_gmt_str_time in aos_util.o
"_apr_time_exp_lt", referenced from:
_aos_log_format_default in aos_log.o
"_apr_time_now", referenced from:
_aos_log_format_default in aos_log.o
_aos_curl_default_header_callback in aos_transport.o
_aos_curl_default_write_callback in aos_transport.o
_aos_curl_http_transport_perform in aos_transport.o
_aos_get_gmt_str_time in aos_util.o
"_curl_easy_cleanup", referenced from:
_request_release in aos_http_io.o
_aos_http_io_deinitialize in aos_http_io.o
"_curl_easy_getinfo", referenced from:
_aos_curl_transport_headers_done in aos_transport.o
"_curl_easy_init", referenced from:
_aos_request_get in aos_http_io.o
"_curl_easy_perform", referenced from:
_aos_curl_http_transport_perform in aos_transport.o
"_curl_easy_reset", referenced from:
_aos_request_get in aos_http_io.o
"_curl_easy_setopt", referenced from:
_aos_curl_transport_setup in aos_transport.o
"_curl_easy_strerror", referenced from:
_aos_http_io_initialize in aos_http_io.o
_aos_curl_http_transport_perform in aos_transport.o
_aos_curl_transport_setup in aos_transport.o
_aos_curl_transport_headers_done in aos_transport.o
"_curl_global_init", referenced from:
_aos_http_io_initialize in aos_http_io.o
"_curl_slist_append", referenced from:
_aos_init_curl_headers in aos_transport.o
"_curl_slist_free_all", referenced from:
_aos_init_curl_headers in aos_transport.o
"_mxmlDelete", referenced from:
_aos_status_parse_from_body in aos_status.o
_oss_acl_parse_from_body in oss_xml.o
_oss_location_parse_from_body in oss_xml.o
_oss_storage_capacity_parse_from_body in oss_xml.o
_oss_logging_parse_from_body in oss_xml.o
_oss_list_objects_parse_from_body in oss_xml.o
_oss_list_buckets_parse_from_body in oss_xml.o
...
"_mxmlFindElement", referenced from:
_aos_status_parse_from_body in aos_status.o
_get_xmlnode_value in oss_xml.o
_oss_logging_parse_from_body in oss_xml.o
_oss_list_objects_owner_parse in oss_xml.o
_oss_list_objects_content_parse in oss_xml.o
_oss_list_objects_contents_parse in oss_xml.o
_oss_list_objects_prefix_parse in oss_xml.o
...
"_mxmlLoadString", referenced from:
_aos_parse_xml_body in aos_util.o
_oss_checkpoint_parse_from_body in oss_xml.o
"_mxmlNewElement", referenced from:
_build_complete_multipart_upload_xml in oss_xml.o
_build_bucket_logging_xml in oss_xml.o
_build_lifecycle_xml in oss_xml.o
_build_referer_config_xml in oss_xml.o
_build_cors_rule_xml in oss_xml.o
_build_website_config_xml in oss_xml.o
_build_bucket_storage_class_xml in oss_xml.o
...
"_mxmlNewText", referenced from:
_build_complete_multipart_upload_xml in oss_xml.o
_build_bucket_logging_xml in oss_xml.o
_build_lifecycle_xml in oss_xml.o
_build_referer_config_xml in oss_xml.o
_build_cors_rule_xml in oss_xml.o
_build_website_config_xml in oss_xml.o
_build_bucket_storage_class_xml in oss_xml.o
...
"_mxmlNewXML", referenced from:
_build_complete_multipart_upload_xml in oss_xml.o
_build_bucket_logging_xml in oss_xml.o
_build_lifecycle_xml in oss_xml.o
_build_referer_config_xml in oss_xml.o
_build_cors_rule_xml in oss_xml.o
_build_website_config_xml in oss_xml.o
_build_bucket_storage_class_xml in oss_xml.o
...
"_mxmlSaveString", referenced from:
_new_xml_buff in oss_xml.o
"_mxml_opaque_cb", referenced from:
_aos_parse_xml_body in aos_util.o
_oss_checkpoint_parse_from_body in oss_xml.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [build/lib/liboss_c_sdk.3.0.0.dylib] Error 1
make[1]: *** [CMakeFiles/oss_c_sdk.dir/all] Error 2
make: *** [all] Error 2

URL的params未区分大小写

API中的URL params用的是apr_table_t,如oss_do_put_object_from_buffer(),oss_do_get_object_to_buffer()等。apr_table_get/set不区分key的大小写,如果外部传入的params的key与oss定义key的有大小写不敏感匹配(如EXPires)时,在对params table进行set时可能覆盖原value,并无法改写key的大小写。这可能导致一些不符合预期的访问。

race condition in crc64 dynamic initialization even if pthread is available

crc64 code uses macro ONCE() to do dynamic initialization, and ONCE() is defined as

/* Run the init() function exactly once.  If pthread.h is not included, then
   this macro will use a simple static state variable for the purpose, which is
   not thread-safe.  The init function must be of the type void init(void). */
#ifdef PTHREAD_ONCE_INIT
#  define ONCE(init) \
    do { \
        static pthread_once_t once = PTHREAD_ONCE_INIT; \
        pthread_once(&once, init); \
    } while (0)
#else
#  define ONCE(init) \
    do { \
        static volatile int once = 1; \
        if (once) { \
            if (once++ == 1) { \
                init(); \
                once = 0; \
            } \
            else \
                while (once) \
                    ; \
        } \
    } while (0)
#endif

So it's meant to be defined to use pthread_once() when pthread is available. But aos_crc64.c doesn't include pthread.h from any header files, so even if we have APR_HAVE_PTHREAD_H defined as 1 (from apr.h), pthread.h is not included either. And this may result in infinite loop in multi-thread environments.

I'll submit a PR for this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.