w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit 5afaccd98a491c4f40133f54e4b6d2571f9d127a
parent 0bd213d2322a943fa6e2430076570bfa0f5a6c7c
Author: ukai <ukai>
Date:   Thu,  6 Dec 2001 22:45:04 +0000

[w3m-dev 02637]
From: Fumitoshi UKAI  <ukai@debian.or.jp>

Diffstat:
MChangeLog | 8++++++++
Murl.c | 25+++++++++++--------------
2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,11 @@ +2001-12-07 Fumitoshi UKAI <ukai@debian.or.jp> + + * [w3m-dev 02637] + * url.c (openSocket): hostname volatile -> const + * url.c (openSocket): add hname + * url.c (openSocket): copy hostname to hname to be modified safely + * url.c (otherinfo): revert previous change + 2001-12-07 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> * [w3m-dev 02635] dirlist diff --git a/url.c b/url.c @@ -419,7 +419,7 @@ baseURL(Buffer *buf) } int -openSocket(char *volatile hostname, +openSocket(char *const hostname, char *remoteport_name, unsigned short remoteport_num) { volatile int sock = -1; @@ -427,6 +427,7 @@ openSocket(char *volatile hostname, int *af; struct addrinfo hints, *res0, *res; int error; + char *hname; #else /* not INET6 */ struct sockaddr_in hostaddr; struct hostent *entry; @@ -462,11 +463,12 @@ openSocket(char *volatile hostname, #ifdef INET6 /* rfc2732 compliance */ - if (hostname != NULL && hostname[0] == '[' && - hostname[strlen(hostname) - 1] == ']') { - hostname[strlen(hostname) - 1] = '\0'; - hostname++; - if (strspn(hostname, "0123456789abcdefABCDEF:.") != strlen(hostname)) + hname = hostname; + if (hname != NULL && hname[0] == '[' && + hname[strlen(hname) - 1] == ']') { + hname = allocStr(hostname + 1, -1); + hname[strlen(hname) - 1] = '\0'; + if (strspn(hname, "0123456789abcdefABCDEF:.") != strlen(hname)) goto error; } for (af = ai_family_order_table[DNS_order];; af++) { @@ -475,14 +477,14 @@ openSocket(char *volatile hostname, hints.ai_socktype = SOCK_STREAM; if (remoteport_num != 0) { Str portbuf = Sprintf("%d", remoteport_num); - error = getaddrinfo(hostname, portbuf->ptr, &hints, &res0); + error = getaddrinfo(hname, portbuf->ptr, &hints, &res0); } else { error = -1; } if (error && remoteport_name && remoteport_name[0] != '\0') { /* try default port */ - error = getaddrinfo(hostname, remoteport_name, &hints, &res0); + error = getaddrinfo(hname, remoteport_name, &hints, &res0); } if (error) { if (*af == PF_UNSPEC) { @@ -1204,12 +1206,7 @@ otherinfo(ParsedURL *target, ParsedURL *current, char *referer) if (target->host) { Strcat_charp(s, "Host: "); -#ifdef INET6 - if (strchr(target->host, ':') != NULL) - Strcat(s, Sprintf("[%s]", target->host)); - else -#endif - Strcat_charp(s, target->host); + Strcat_charp(s, target->host); if (target->port != DefaultPort[target->scheme]) Strcat(s, Sprintf(":%d", target->port)); Strcat_charp(s, "\r\n");