summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-12-02 00:06:54 +0100
committerThomas Haller <thaller@redhat.com>2018-12-11 09:23:47 +0100
commit3e04d5a71591f66ace3878909c3d27905f0f3dec (patch)
treeb9cb08da77a4d2b3261dabfe2e70ec8d63fb3817
parent2e8ea1f1daea653722b10b627b89f29cec44d346 (diff)
downloadNetworkManager-3e04d5a71591f66ace3878909c3d27905f0f3dec.tar.gz
connectivity: use 443 port for https URIs
If the URI does not specify a port, we always assumed "80". That is wrong for https. Arguably, https is discouraged for connectivity checking, but we still shouldn't break it. Fixes: 9664f284a1d8575798daa9abf9cd7f49a19b48d9
-rw-r--r--src/nm-connectivity.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c
index 0fc724b6e8..5f0567e9d0 100644
--- a/src/nm-connectivity.c
+++ b/src/nm-connectivity.c
@@ -936,12 +936,14 @@ update_config (NMConnectivity *self, NMConfigData *config_data)
new_uri_valid = (new_uri && *new_uri);
if (new_uri_valid) {
gs_free char *scheme = g_uri_parse_scheme (new_uri);
+ gboolean is_https = FALSE;
if (!scheme) {
_LOGE ("invalid URI '%s' for connectivity check.", new_uri);
new_uri_valid = FALSE;
} else if (g_ascii_strcasecmp (scheme, "https") == 0) {
_LOGW ("use of HTTPS for connectivity checking is not reliable and is discouraged (URI: %s)", new_uri);
+ is_https = TRUE;
} else if (g_ascii_strcasecmp (scheme, "http") != 0) {
_LOGE ("scheme of '%s' uri doesn't use a scheme that is allowed for connectivity check.", new_uri);
new_uri_valid = FALSE;
@@ -951,7 +953,8 @@ update_config (NMConnectivity *self, NMConfigData *config_data)
if (!host_and_port_from_uri (new_uri, &new_host, &new_port)) {
_LOGE ("cannot parse host and port from '%s'", new_uri);
new_uri_valid = FALSE;
- }
+ } else if (!new_port && is_https)
+ new_port = g_strdup ("443");
}
}