fetch: hardcode HTTPS port and fallback to /etc/services for other unknown ports.

This commit is contained in:
Juan RP
2014-08-25 16:07:47 +02:00
parent bc92b387cb
commit 25e8002737
3 changed files with 8 additions and 2 deletions

View File

@ -201,12 +201,14 @@ fetch_default_port(const char *scheme)
{
struct servent *se;
if ((se = getservbyname(scheme, "tcp")) != NULL)
return (ntohs(se->s_port));
if (strcasecmp(scheme, SCHEME_FTP) == 0)
return (FTP_DEFAULT_PORT);
if (strcasecmp(scheme, SCHEME_HTTP) == 0)
return (HTTP_DEFAULT_PORT);
if (strcasecmp(scheme, SCHEME_HTTPS) == 0)
return (HTTPS_DEFAULT_PORT);
if ((se = getservbyname(scheme, "tcp")) != NULL)
return (ntohs(se->s_port));
return (0);
}