summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriadne Conill <ariadne@dereferenced.org>2020-05-28 17:23:17 -0600
committerTimo Teräs <timo.teras@iki.fi>2021-04-11 14:01:04 +0300
commitece78f1fe51d56752a9307b00f79bbf730f9d4cd (patch)
tree5a4d52a1fd3c8764087126ab345c2141c22d0c51
parent2ce4ddf4e9ec126c79007e135594adccfe62da31 (diff)
downloadapk-tools-ece78f1fe51d56752a9307b00f79bbf730f9d4cd.tar.gz
apk-tools-ece78f1fe51d56752a9307b00f79bbf730f9d4cd.tar.bz2
apk-tools-ece78f1fe51d56752a9307b00f79bbf730f9d4cd.tar.xz
apk-tools-ece78f1fe51d56752a9307b00f79bbf730f9d4cd.zip
libfetch: implement default port for HTTPS.
If getservbyname() fails, libfetch will attempt to connect to port 0. (cherry picked from commit ffcdd350d02fb51d91e83a153e58ddbb66bfeb31)
-rw-r--r--libfetch/common.c2
-rw-r--r--libfetch/common.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/libfetch/common.c b/libfetch/common.c
index 9cbe32d..537715b 100644
--- a/libfetch/common.c
+++ b/libfetch/common.c
@@ -184,6 +184,8 @@ fetch_default_port(const char *scheme)
return (FTP_DEFAULT_PORT);
if (strcasecmp(scheme, SCHEME_HTTP) == 0)
return (HTTP_DEFAULT_PORT);
+ if (strcasecmp(scheme, SCHEME_HTTPS) == 0)
+ return (HTTPS_DEFAULT_PORT);
return (0);
}
diff --git a/libfetch/common.h b/libfetch/common.h
index d7ad1d6..fc78f16 100644
--- a/libfetch/common.h
+++ b/libfetch/common.h
@@ -34,6 +34,7 @@
#define FTP_DEFAULT_PORT 21
#define HTTP_DEFAULT_PORT 80
+#define HTTPS_DEFAULT_PORT 443
#define FTP_DEFAULT_PROXY_PORT 21
#define HTTP_DEFAULT_PROXY_PORT 3128