The port number might have changed in the proxy case. Re-evaluate it.

This commit is contained in:
christos 1999-08-31 22:05:22 +00:00
parent 0f5eb412c3
commit 915a67c083
1 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fetch.c,v 1.67 1999/08/31 21:30:25 christos Exp $ */
/* $NetBSD: fetch.c,v 1.68 1999/08/31 22:05:22 christos Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fetch.c,v 1.67 1999/08/31 21:30:25 christos Exp $");
__RCSID("$NetBSD: fetch.c,v 1.68 1999/08/31 22:05:22 christos Exp $");
#endif /* not lint */
/*
@ -652,6 +652,12 @@ fetch_url(url, proxyenv, proxyauth, wwwauth)
warnx("Unknown port for URL `%s'", url);
goto cleanup_fetch_url;
}
portnum = strtol(port, &ep, 10);
if (*ep || port == ep) {
struct servent *svp = getservbyname(port, "tcp");
if (svp != NULL)
portnum = ntohs(svp->s_port);
}
sin.sin_port = portnum;
s = socket(AF_INET, SOCK_STREAM, 0);