diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-10-27 14:56:05 +1100 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-11-24 11:42:25 +1100 |
commit | a055f6714fd06aa3b633b1bc44a8dbf42a0eedb0 (patch) | |
tree | 6223076e8bcfe2c828f4b40d6a4fb8760f520c7b /lib/pb-protocol | |
parent | 1dd51e986202e5e111c1042f148867bd08c2bedc (diff) | |
download | petitboot-a055f6714fd06aa3b633b1bc44a8dbf42a0eedb0.zip petitboot-a055f6714fd06aa3b633b1bc44a8dbf42a0eedb0.tar.gz |
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 'lib/pb-protocol')
-rw-r--r-- | lib/pb-protocol/pb-protocol.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 47d04a3..64bd161 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -305,6 +305,9 @@ int pb_protocol_config_len(const struct config *config) for (i = 0; i < config->network.n_dns_servers; i++) len += 4 + optional_strlen(config->network.dns_servers[i]); + len += 4 + optional_strlen(config->http_proxy); + len += 4 + optional_strlen(config->https_proxy); + len += 4; for (i = 0; i < config->n_autoboot_opts; i++) { if (config->autoboot_opts[i].boot_type == BOOT_DEVICE_TYPE) @@ -550,6 +553,9 @@ int pb_protocol_serialise_config(const struct config *config, config->network.dns_servers[i]); } + pos += pb_protocol_serialise_string(pos, config->http_proxy); + pos += pb_protocol_serialise_string(pos, config->https_proxy); + *(uint32_t *)pos = __cpu_to_be32(config->n_autoboot_opts); pos += 4; for (i = 0; i < config->n_autoboot_opts; i++) { @@ -1082,6 +1088,13 @@ int pb_protocol_deserialise_config(struct config *config, config->network.dns_servers[i] = str; } + if (read_string(config, &pos, &len, &str)) + goto out; + config->http_proxy = str; + if (read_string(config, &pos, &len, &str)) + goto out; + config->https_proxy = str; + if (read_u32(&pos, &len, &config->n_autoboot_opts)) goto out; config->autoboot_opts = talloc_array(config, struct autoboot_option, |