summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-config.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-10-27 14:56:05 +1100
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-11-24 11:42:25 +1100
commita055f6714fd06aa3b633b1bc44a8dbf42a0eedb0 (patch)
tree6223076e8bcfe2c828f4b40d6a4fb8760f520c7b /ui/ncurses/nc-config.c
parent1dd51e986202e5e111c1042f148867bd08c2bedc (diff)
downloadtalos-petitboot-a055f6714fd06aa3b633b1bc44a8dbf42a0eedb0.tar.gz
talos-petitboot-a055f6714fd06aa3b633b1bc44a8dbf42a0eedb0.zip
Support HTTP(S) proxies when downloading resources
Allow the user to specify a HTTP and HTTPS proxy server. The discover server will set the http_proxy and https_proxy environment variables, enabling the proxy servers for any further HTTP(S) requests. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'ui/ncurses/nc-config.c')
-rw-r--r--ui/ncurses/nc-config.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c
index 1bc77e8..8349629 100644
--- a/ui/ncurses/nc-config.c
+++ b/ui/ncurses/nc-config.c
@@ -33,7 +33,7 @@
#include "nc-config.h"
#include "nc-widgets.h"
-#define N_FIELDS 44
+#define N_FIELDS 48
extern struct help_text config_help_text;
@@ -106,6 +106,10 @@ struct config_screen {
struct nc_widget_textbox *dns_f;
struct nc_widget_label *dns_dhcp_help_l;
struct nc_widget_label *dns_help_l;
+ struct nc_widget_label *http_proxy_l;
+ struct nc_widget_textbox *http_proxy_f;
+ struct nc_widget_label *https_proxy_l;
+ struct nc_widget_textbox *https_proxy_f;
struct nc_widget_label *allow_write_l;
struct nc_widget_select *allow_write_f;
@@ -335,6 +339,13 @@ static int screen_process_form(struct config_screen *screen)
}
}
+ talloc_free(config->http_proxy);
+ talloc_free(config->https_proxy);
+ str = widget_textbox_get_value(screen->widgets.http_proxy_f);
+ config->http_proxy = talloc_strdup(config, str);
+ str = widget_textbox_get_value(screen->widgets.https_proxy_f);
+ config->https_proxy = talloc_strdup(config, str);
+
allow_write = widget_select_get_value(screen->widgets.allow_write_f);
if (allow_write != config->allow_writes)
config->allow_writes = allow_write;
@@ -585,6 +596,13 @@ static void config_screen_layout_widgets(struct config_screen *screen)
y += 1;
}
+ wf = widget_textbox_base(screen->widgets.http_proxy_f);
+ layout_pair(screen, y, screen->widgets.http_proxy_l, wf);
+ y++;
+ wf = widget_textbox_base(screen->widgets.https_proxy_f);
+ layout_pair(screen, y, screen->widgets.https_proxy_l, wf);
+ y++;
+
y += 1;
layout_pair(screen, y, screen->widgets.allow_write_l,
@@ -1028,6 +1046,15 @@ static void config_screen_setup_widgets(struct config_screen *screen,
screen->widgets.dns_dhcp_help_l = widget_new_label(set, 0, 0,
_("(if not provided by DHCP server)"));
+ screen->widgets.http_proxy_l = widget_new_label(set, 0, 0,
+ _("HTTP Proxy:"));
+ screen->widgets.http_proxy_f = widget_new_textbox(set, 0, 0, 32,
+ config->http_proxy);
+ screen->widgets.https_proxy_l = widget_new_label(set, 0, 0,
+ _("HTTPS Proxy:"));
+ screen->widgets.https_proxy_f = widget_new_textbox(set, 0, 0, 32,
+ config->https_proxy);
+
if (config->safe_mode)
screen->widgets.safe_mode = widget_new_label(set, 0, 0,
_("Selecting 'OK' will exit safe mode"));
OpenPOWER on IntegriCloud