diff options
Diffstat (limited to 'WWW')
-rw-r--r-- | WWW/Library/Implementation/HTAccess.c | 24 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFinger.c | 6 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTGopher.c | 11 | ||||
-rw-r--r-- | WWW/Library/Implementation/SGML.c | 14 |
4 files changed, 30 insertions, 25 deletions
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c index de47c209..62f74c77 100644 --- a/WWW/Library/Implementation/HTAccess.c +++ b/WWW/Library/Implementation/HTAccess.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAccess.c,v 1.71 2010/09/24 08:51:18 tom Exp $ + * $LynxId: HTAccess.c,v 1.73 2010/10/03 22:49:46 tom Exp $ * * Access Manager HTAccess.c * ============== @@ -285,9 +285,8 @@ BOOL override_proxy(const char *addr) return NO; } - if (NULL != (p = strrchr(Host, ':'))) { /* Port specified */ + if (NULL != (p = HTParsePort(Host, &port))) { /* Port specified */ *p++ = 0; /* Chop off port */ - port = atoi(p); } else { /* Use default port */ acc_method = HTParse(addr, "", PARSE_ACCESS); if (acc_method != NULL) { @@ -329,18 +328,24 @@ BOOL override_proxy(const char *addr) const char *colon = NULL; int templ_port = 0; int t_len; + int brackets = 0; while (*no_proxy && (WHITE(*no_proxy) || *no_proxy == ',')) no_proxy++; /* Skip whitespace and separators */ end = no_proxy; while (*end && !WHITE(*end) && *end != ',') { /* Find separator */ - if (*end == ':') + if (!brackets && (*end == ':')) colon = end; /* Port number given */ + else if (*end == '[') + ++brackets; + else if (*end == ']') + --brackets; end++; } if (colon) { + /* unlike HTParsePort(), this may be followed by non-digits */ templ_port = atoi(colon + 1); t_len = (int) (colon - no_proxy); } else { @@ -448,15 +453,16 @@ static int get_physical(const char *addr, #ifdef USE_GATEWAYS if (!override_flag && !using_proxy) { /* else ignore no_proxy env var */ + char *host = NULL; + int port; + if (!strcasecomp(acc_method, "news")) { /* * News is different, so we need to check the name of the server, * as well as the default port for selective exclusions. */ - char *host = NULL; - if ((host = HTParse(addr, "", PARSE_HOST))) { - if (strchr(host, ':') == NULL) { + if (HTParsePort(host, &port) == NULL) { StrAllocCopy(Server_addr, "news://"); StrAllocCat(Server_addr, host); StrAllocCat(Server_addr, ":119/"); @@ -472,10 +478,8 @@ static int get_physical(const char *addr, * Wais also needs checking of the default port for selective * exclusions. */ - char *host = NULL; - if ((host = HTParse(addr, "", PARSE_HOST))) { - if (!(strchr(host, ':'))) { + if (!(HTParsePort(host, &port))) { StrAllocCopy(Server_addr, "wais://"); StrAllocCat(Server_addr, host); StrAllocCat(Server_addr, ":210/"); diff --git a/WWW/Library/Implementation/HTFinger.c b/WWW/Library/Implementation/HTFinger.c index b7911309..0bc0a448 100644 --- a/WWW/Library/Implementation/HTFinger.c +++ b/WWW/Library/Implementation/HTFinger.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFinger.c,v 1.27 2010/09/24 08:30:28 tom Exp $ + * $LynxId: HTFinger.c,v 1.28 2010/10/03 22:10:34 tom Exp $ * * FINGER ACCESS HTFinger.c * ============= @@ -324,9 +324,7 @@ int HTLoadFinger(const char *arg, if (*sitename == '\0') { HTAlert(gettext("Could not load data (no sitename in finger URL)")); result = HT_NOT_LOADED; /* Ignore if no name */ - } else if ((colon = strchr(sitename, ':')) != NULL) { - *colon++ = '\0'; - port = atoi(colon); + } else if ((colon = HTParsePort(sitename, &port)) != NULL) { if (port != 79) { HTAlert(gettext("Invalid port number - will only use port 79!")); result = HT_NOT_LOADED; /* Ignore if wrong port */ diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index 920263ba..85a05d2e 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTGopher.c,v 1.50 2010/09/25 00:43:55 tom Exp $ + * $LynxId: HTGopher.c,v 1.51 2010/10/03 22:30:43 tom Exp $ * * GOPHER ACCESS HTGopher.c * ============= @@ -1527,12 +1527,9 @@ static int HTLoadCSO(const char *arg, return HT_NOT_LOADED; } host = HTParse(arg, "", PARSE_HOST); - if ((cp = strchr(host, ':')) != NULL) { - if (cp[1] >= '0' && cp[1] <= '9') { - port = atoi((cp + 1)); - if (port == CSO_PORT) { - *cp = '\0'; - } + if ((cp = HTParsePort(host, &port)) != NULL) { + if (port == CSO_PORT) { + *cp = '\0'; } } anAnchor->safe = TRUE; diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index d00b5be3..0b1edebc 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -1,5 +1,5 @@ /* - * $LynxId: SGML.c,v 1.139 2010/09/25 15:40:04 tom Exp $ + * $LynxId: SGML.c,v 1.140 2010/10/04 00:04:12 tom Exp $ * * General SGML Parser code SGML.c * ======================== @@ -39,6 +39,11 @@ # include <LYPrettySrc.h> #endif +#define AssumeCP1252(context) \ + (((context)->inUCLYhndl == LATIN1 \ + || (context)->inUCLYhndl == US_ASCII) \ + && !(context)->extended_html) + #define INVALID (-1) static int sgml_offset; @@ -1910,8 +1915,7 @@ static void SGML_character(HTStream *context, int c_in) * * http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#character-encodings-0 */ - if (context->inUCLYhndl == LATIN1 - || context->inUCLYhndl == US_ASCII) { + if (AssumeCP1252(context)) { clong = LYcp1252ToUnicode((UCode_t) c); goto top1; } @@ -2641,7 +2645,9 @@ static void SGML_character(HTStream *context, int c_in) UCode_t code = (UCode_t) lcode; /* =============== work in ASCII below here =============== S/390 -- gil -- 1092 */ - code = LYcp1252ToUnicode(code); + if (AssumeCP1252(context)) { + code = LYcp1252ToUnicode(code); + } /* * Check for special values. - FM */ |