From: Vladislav Grigoryev Date: Wed, 1 Sep 2021 05:48:08 +0000 (+0300) Subject: libopkg: support https_proxy X-Git-Url: http://git.openwrt.org/openwrt/docs.git?a=commitdiff_plain;h=d038e5b6d155784575f62a66a8bb7e874173e92e;p=project%2Fopkg-lede.git libopkg: support https_proxy Add support for https_proxy since feeds switched to HTTPS. In general case, https_proxy may not match http_proxy. Process http_proxy, https_proxy, and ftp_proxy separately. Signed-off-by: Vladislav Grigoryev --- diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c index e36f66b..0cbd1cc 100644 --- a/libopkg/opkg_conf.c +++ b/libopkg/opkg_conf.c @@ -58,6 +58,7 @@ opkg_option_t options[] = { {"ftp_proxy", OPKG_OPT_TYPE_STRING, &_conf.ftp_proxy}, {"http_proxy", OPKG_OPT_TYPE_STRING, &_conf.http_proxy}, {"http_timeout", OPKG_OPT_TYPE_STRING, &_conf.http_timeout}, + {"https_proxy", OPKG_OPT_TYPE_STRING, &_conf.https_proxy}, {"no_proxy", OPKG_OPT_TYPE_STRING, &_conf.no_proxy}, {"test", OPKG_OPT_TYPE_BOOL, &_conf.noaction}, {"noaction", OPKG_OPT_TYPE_BOOL, &_conf.noaction}, diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h index cd69ceb..781c8f4 100644 --- a/libopkg/opkg_conf.h +++ b/libopkg/opkg_conf.h @@ -96,6 +96,7 @@ struct opkg_conf { /* proxy options */ char *http_proxy; char *http_timeout; + char *https_proxy; char *ftp_proxy; char *no_proxy; char *proxy_user; diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c index cce4b6d..af91f12 100644 --- a/libopkg/opkg_download.c +++ b/libopkg/opkg_download.c @@ -133,6 +133,12 @@ opkg_download(const char *src, const char *dest_file_name, conf->http_proxy); setenv("http_proxy", conf->http_proxy, 1); } + if (conf->https_proxy) { + opkg_msg(DEBUG, + "Setting environment variable: https_proxy = %s.\n", + conf->https_proxy); + setenv("https_proxy", conf->https_proxy, 1); + } if (conf->ftp_proxy) { opkg_msg(DEBUG, "Setting environment variable: ftp_proxy = %s.\n", @@ -160,7 +166,7 @@ opkg_download(const char *src, const char *dest_file_name, argv[i++] = "--timeout"; argv[i++] = conf->http_timeout; } - if (conf->http_proxy || conf->ftp_proxy) { + if (conf->http_proxy || conf->https_proxy || conf->ftp_proxy) { argv[i++] = "-Y"; argv[i++] = "on"; }