libopkg: support https_proxy
authorVladislav Grigoryev <vg.aetera@gmail.com>
Wed, 1 Sep 2021 05:48:08 +0000 (08:48 +0300)
committerPetr Štetiar <ynezz@true.cz>
Thu, 24 Feb 2022 20:27:58 +0000 (21:27 +0100)
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 <vg.aetera@gmail.com>
libopkg/opkg_conf.c
libopkg/opkg_conf.h
libopkg/opkg_download.c

index e36f66bb79dd639e1c6f7554b6ba6de392a31cbf..0cbd1ccab73fb1c8051ffd811d8e2c40f010e969 100644 (file)
@@ -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},
index cd69cebbb11abecf1fb8548509c0f0504c1c694d..781c8f4c72ae6e3c2f90dc6f38356c4bef4e7e5c 100644 (file)
@@ -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;
index cce4b6d77ea464ec789b3b609be38e35b78fd15b..af91f12a429ff33994c6da37d55cee45bcef97af 100644 (file)
@@ -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";
                }