Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
2fd93a20
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2fd93a20
编写于
6月 20, 2020
作者:
W
WangFengTu
提交者:
lifeng68
7月 25, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
do not call isulad specific function in http utils
Signed-off-by:
N
WangFengTu
<
wangfengtu@huawei.com
>
上级
49d2c4c1
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
20 addition
and
8 deletion
+20
-8
src/daemon/image/oci/registry/http_request.c
src/daemon/image/oci/registry/http_request.c
+4
-2
src/http/http.c
src/http/http.c
+14
-6
src/http/http.h
src/http/http.h
+2
-0
未找到文件。
src/daemon/image/oci/registry/http_request.c
浏览文件 @
2fd93a20
...
@@ -514,7 +514,8 @@ static int http_request_buf_options(pull_descriptor *desc, struct http_get_optio
...
@@ -514,7 +514,8 @@ static int http_request_buf_options(pull_descriptor *desc, struct http_get_optio
options
->
output
=
output_buffer
;
options
->
output
=
output_buffer
;
ret
=
http_request
(
url
,
options
,
NULL
,
0
);
ret
=
http_request
(
url
,
options
,
NULL
,
0
);
if
(
ret
)
{
if
(
ret
)
{
ERROR
(
"Failed to get http request"
);
ERROR
(
"Failed to get http request: %s"
,
options
->
errmsg
);
isulad_try_set_error_message
(
"%s"
,
options
->
errmsg
);
ret
=
-
1
;
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
...
@@ -715,7 +716,8 @@ int http_request_file(pull_descriptor *desc, const char *url, const char **custo
...
@@ -715,7 +716,8 @@ int http_request_file(pull_descriptor *desc, const char *url, const char **custo
ret
=
http_request
(
url
,
options
,
NULL
,
0
);
ret
=
http_request
(
url
,
options
,
NULL
,
0
);
if
(
ret
)
{
if
(
ret
)
{
ERROR
(
"Failed to get http request"
);
ERROR
(
"Failed to get http request: %s"
,
options
->
errmsg
);
isulad_try_set_error_message
(
"%s"
,
options
->
errmsg
);
ret
=
-
1
;
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
...
...
src/http/http.c
浏览文件 @
2fd93a20
...
@@ -72,6 +72,9 @@ void free_http_get_options(struct http_get_options *options)
...
@@ -72,6 +72,9 @@ void free_http_get_options(struct http_get_options *options)
free
(
options
->
key_file
);
free
(
options
->
key_file
);
options
->
key_file
=
NULL
;
options
->
key_file
=
NULL
;
free
(
options
->
errmsg
);
options
->
errmsg
=
NULL
;
/* The options->output is a FILE pointer, we should not free it here */
/* The options->output is a FILE pointer, we should not free it here */
free
(
options
);
free
(
options
);
return
;
return
;
...
@@ -243,21 +246,26 @@ static void free_rpath(char *rpath)
...
@@ -243,21 +246,26 @@ static void free_rpath(char *rpath)
free
(
rpath
);
free
(
rpath
);
}
}
static
void
check_buf_len
(
char
*
errbuf
,
CURLcode
curl_result
)
static
void
check_buf_len
(
struct
http_get_options
*
options
,
char
*
errbuf
,
CURLcode
curl_result
)
{
{
int
nret
=
0
;
int
nret
=
0
;
size_t
len
=
0
;
size_t
len
=
0
;
if
(
options
==
NULL
||
options
->
errmsg
!=
NULL
)
{
return
;
}
len
=
strlen
(
errbuf
);
len
=
strlen
(
errbuf
);
if
(
len
>
0
)
{
if
(
len
==
0
)
{
fprintf
(
stderr
,
"%s%s"
,
errbuf
,
((
errbuf
[
len
-
1
]
!=
'\n'
)
?
"
\n
"
:
""
));
}
else
{
nret
=
snprintf
(
errbuf
,
CURL_ERROR_SIZE
,
"curl response error code %d"
,
curl_result
);
nret
=
snprintf
(
errbuf
,
CURL_ERROR_SIZE
,
"curl response error code %d"
,
curl_result
);
if
(
nret
<
0
||
(
size_t
)
nret
>=
CURL_ERROR_SIZE
)
{
if
(
nret
<
0
||
(
size_t
)
nret
>=
CURL_ERROR_SIZE
)
{
ERROR
(
"Failed to print string for error buffer, errcode %d"
,
curl_result
);
ERROR
(
"Failed to print string for error buffer, errcode %d"
,
curl_result
);
return
;
return
;
}
}
}
}
isulad_try_set_error_message
(
"%s"
,
errbuf
);
options
->
errmsg
=
util_strdup_s
(
errbuf
);
return
;
}
}
static
void
buffer_empty_on_condition
(
struct
http_get_options
*
options
)
static
void
buffer_empty_on_condition
(
struct
http_get_options
*
options
)
...
@@ -367,7 +375,7 @@ int http_request(const char *url, struct http_get_options *options, long *respon
...
@@ -367,7 +375,7 @@ int http_request(const char *url, struct http_get_options *options, long *respon
curl_result
=
curl_easy_perform
(
curl_handle
);
curl_result
=
curl_easy_perform
(
curl_handle
);
if
(
curl_result
!=
CURLE_OK
)
{
if
(
curl_result
!=
CURLE_OK
)
{
check_buf_len
(
errbuf
,
curl_result
);
check_buf_len
(
options
,
errbuf
,
curl_result
);
ret
=
-
1
;
ret
=
-
1
;
}
else
{
}
else
{
curl_getinfo_on_condition
(
response_code
,
curl_handle
,
&
tmp
);
curl_getinfo_on_condition
(
response_code
,
curl_handle
,
&
tmp
);
...
...
src/http/http.h
浏览文件 @
2fd93a20
...
@@ -68,6 +68,8 @@ struct http_get_options {
...
@@ -68,6 +68,8 @@ struct http_get_options {
char
*
cert_file
;
char
*
cert_file
;
char
*
key_file
;
char
*
key_file
;
char
*
errmsg
;
void
*
progressinfo
;
void
*
progressinfo
;
progress_info_func
progress_info_op
;
progress_info_func
progress_info_op
;
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录