From: janp Date: Thu, 8 Mar 2001 23:11:03 +0000 (-0800) Subject: [svn] Skip `:port' in the host header if it is the DEFAULT_HTTPS_PORT when X-Git-Tag: v1.13~2250 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=5014d32c3aeaee3089d2431edd1c27adce72c673 [svn] Skip `:port' in the host header if it is the DEFAULT_HTTPS_PORT when using SSL. Patch submitted by Hack Kampbjorn . --- diff --git a/src/ChangeLog b/src/ChangeLog index 46c4f61f..be35c604 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2001-03-06 Hack Kampbjorn + + * http.c (gethttp): skip :port in host header if it is the + DEFAULT_HTTPS_PORT when using SSL. + + * url.c: move the #define of DEFAULT_HTTP_PORT, DEFAULT_FTP_PORT + and DEFAULT_HTTPS_PORT to the header file so it can be use in the + rest of the code. + * url.h: Ditto + 2001-03-01 Jonas Jensen * retr.c (show_progress): Correctly calculate the number of bytes diff --git a/src/http.c b/src/http.c index 01316292..28743bd3 100644 --- a/src/http.c +++ b/src/http.c @@ -617,7 +617,7 @@ gethttp (struct urlinfo *u, struct http_stat *hs, int *dt) { logprintf (LOG_VERBOSE, _("Connecting to %s:%hu... "), u->host, u->port); err = make_connection (&sock, u->host, u->port); - switch (err) + switch (err) { case HOSTERR: logputs (LOG_VERBOSE, "\n"); @@ -780,7 +780,11 @@ gethttp (struct urlinfo *u, struct http_stat *hs, int *dt) /* String of the form :PORT. Used only for non-standard ports. */ port_maybe = NULL; - if (remport != 80) +#ifdef HAVE_SSL + if (remport != (u->proto == URLHTTPS ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT) ) +#else + if (remport != DEFAULT_HTTP_PORT) +#endif { port_maybe = (char *)alloca (numdigit (remport) + 2); sprintf (port_maybe, ":%d", remport); diff --git a/src/url.c b/src/url.c index 4c8f35aa..f29c567a 100644 --- a/src/url.c +++ b/src/url.c @@ -43,11 +43,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ extern int errno; #endif -/* Default port definitions */ -#define DEFAULT_HTTP_PORT 80 -#define DEFAULT_FTP_PORT 21 -#define DEFAULT_HTTPS_PORT 443 - /* Table of Unsafe chars. This is intialized in init_unsafe_char_table. */ diff --git a/src/url.h b/src/url.h index bfe78426..e53cf2d7 100644 --- a/src/url.h +++ b/src/url.h @@ -20,6 +20,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef URL_H #define URL_H +/* Default port definitions */ +#define DEFAULT_HTTP_PORT 80 +#define DEFAULT_FTP_PORT 21 +#define DEFAULT_HTTPS_PORT 443 + + /* If the string contains unsafe characters, duplicate it with encode_string, otherwise just copy it with strdup. */ #define CLEANDUP(x) (contains_unsafe (x) ? encode_string (x) : xstrdup (x))