libfetch: implement default port for HTTPS.

If getservbyname() fails, libfetch will attempt to connect to port 0.
cute-signatures
Ariadne Conill 2020-05-28 17:23:17 -06:00 committed by Timo Teräs
parent 8b63e0fcfb
commit ffcdd350d0
2 changed files with 3 additions and 0 deletions

View File

@ -184,6 +184,8 @@ fetch_default_port(const char *scheme)
return (FTP_DEFAULT_PORT); return (FTP_DEFAULT_PORT);
if (strcasecmp(scheme, SCHEME_HTTP) == 0) if (strcasecmp(scheme, SCHEME_HTTP) == 0)
return (HTTP_DEFAULT_PORT); return (HTTP_DEFAULT_PORT);
if (strcasecmp(scheme, SCHEME_HTTPS) == 0)
return (HTTPS_DEFAULT_PORT);
return (0); return (0);
} }

View File

@ -34,6 +34,7 @@
#define FTP_DEFAULT_PORT 21 #define FTP_DEFAULT_PORT 21
#define HTTP_DEFAULT_PORT 80 #define HTTP_DEFAULT_PORT 80
#define HTTPS_DEFAULT_PORT 443
#define FTP_DEFAULT_PROXY_PORT 21 #define FTP_DEFAULT_PROXY_PORT 21
#define HTTP_DEFAULT_PROXY_PORT 3128 #define HTTP_DEFAULT_PROXY_PORT 3128