提交 fba1237b 编写于 作者: W WangFengTu 提交者: lifeng68

Use https if ping https success

Signed-off-by: NWangFengTu <wangfengtu@huawei.com>
上级 a913fe62
......@@ -2031,7 +2031,6 @@ void free_pull_desc(pull_descriptor *desc)
free(desc->protocol);
desc->protocol = NULL;
desc->skip_tls_verify = false;
desc->already_ping = false;
free(desc->scope);
desc->scope = NULL;
......
......@@ -34,7 +34,7 @@
#include "isula_libutils/registry_manifest_list.h"
#include "auths.h"
#define DOCKER_API_VERSION_HEADER "Docker-Distribution-API-Version: registry/2.0"
#define DOCKER_API_VERSION_HEADER "Docker-Distribution-Api-Version: registry/2.0"
#define MAX_ACCEPT_LEN 128
static int parse_http_header(char *resp_buf, size_t buf_size, struct parsed_http_message *message)
......@@ -361,12 +361,13 @@ static int registry_ping(pull_descriptor *desc)
return -1;
}
if (desc->already_ping && desc->protocol != NULL) {
if (desc->protocol != NULL) {
return 0;
}
ret = registry_pingv2(desc, "https");
if (ret == 0) {
desc->protocol = util_strdup_s("https");
goto out;
}
......@@ -378,17 +379,13 @@ static int registry_ping(pull_descriptor *desc)
ERROR("ping %s with http failed", desc->host);
goto out;
}
desc->protocol = util_strdup_s("http");
} else {
ERROR("ping %s with https failed", desc->host);
}
out:
if (ret == 0) {
desc->protocol = util_strdup_s("http");
desc->already_ping = true;
}
return ret;
}
......
......@@ -90,7 +90,6 @@ typedef struct {
char *protocol;
bool skip_tls_verify;
bool insecure_registry;
bool already_ping;
char *scope;
challenge challenges[CHALLENGE_MAX];
// This is temporary field. Once http request is performed, it is cleared
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册