From e7b70b64af3b0c7608d63db5dd2743e5d6d7843b Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Tue, 15 Nov 2016 09:36:45 -0500 Subject: snapshot of project "lynx", label v2-8-9dev_10a --- WWW/Library/Implementation/HTTCP.c | 13 +++---------- WWW/Library/Implementation/HTTP.c | 8 ++++---- WWW/Library/Implementation/HTUtils.h | 4 +++- 3 files changed, 10 insertions(+), 15 deletions(-) (limited to 'WWW/Library') diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index ff1cf9aa..54491956 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTCP.c,v 1.134 2014/12/03 01:00:40 tom Exp $ + * $LynxId: HTTCP.c,v 1.135 2016/11/15 09:31:58 tom Exp $ * * Generic Communication Code HTTCP.c * ========================== @@ -1804,7 +1804,6 @@ int HTDoConnect(const char *url, int status = 0; char *line = NULL; char *p1 = NULL; - char *at_sign = NULL; char *host = NULL; #ifdef INET6 @@ -1826,14 +1825,8 @@ int HTDoConnect(const char *url, * Get node name and optional port number. */ p1 = HTParse(url, "", PARSE_HOST); - if ((at_sign = StrChr(p1, '@')) != NULL) { - /* - * If there's an @ then use the stuff after it as a hostname. - */ - StrAllocCopy(host, (at_sign + 1)); - } else { - StrAllocCopy(host, p1); - } + StrAllocCopy(host, p1); + strip_userid(host, FALSE); FREE(p1); HTSprintf0(&line, "%s%s", WWW_FIND_MESSAGE, host); diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index a5be9264..08ed0c08 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTTP.c,v 1.159 2016/11/08 09:38:27 tom Exp $ + * $LynxId: HTTP.c,v 1.160 2016/11/15 09:31:41 tom Exp $ * * HyperText Tranfer Protocol - Client implementation HTTP.c * ========================== @@ -582,7 +582,7 @@ static char *fake_hostname(char *auth) /* * Strip any username from the given string so we retain only the host. */ -static void strip_userid(char *host) +void strip_userid(char *host, int parse_only) { char *p1 = host; char *p2 = skip_user_passwd(host); @@ -633,7 +633,7 @@ static void strip_userid(char *host) gettext("User/password may be confused with hostname: '%s' (e.g, '%s')"), auth, fake); } - if (msg != 0) + if (msg != 0 && !parse_only) HTAlert(msg); if (do_trimming) { while ((*p1++ = *p2++) != '\0') { @@ -1312,7 +1312,7 @@ static int HTLoadHTTP(const char *arg, char *host = NULL; if ((host = HTParse(anAnchor->address, "", PARSE_HOST)) != NULL) { - strip_userid(host); + strip_userid(host, TRUE); HTBprintf(&command, "Host: %s%c%c", host, CR, LF); FREE(host); } diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h index d0757e55..5c221ccb 100644 --- a/WWW/Library/Implementation/HTUtils.h +++ b/WWW/Library/Implementation/HTUtils.h @@ -1,5 +1,5 @@ /* - * $LynxId: HTUtils.h,v 1.120 2014/01/19 15:18:01 tom Exp $ + * $LynxId: HTUtils.h,v 1.121 2016/11/15 09:26:37 tom Exp $ * * Utility macros for the W3 code library * MACROS FOR GENERAL USE @@ -801,6 +801,8 @@ extern "C" { extern FILE *TraceFP(void); + extern void strip_userid(char *host, int warn); + #ifdef USE_SSL extern SSL *HTGetSSLHandle(void); extern void HTSSLInitPRNG(void); -- cgit 1.4.1-2-gfad0