diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1997-11-07 12:30:00 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1997-11-07 12:30:00 -0500 |
commit | b63d287c6f3e67f8574ca2155c661288bc7dcd05 (patch) | |
tree | 6a3b376424faf4d50058e91988c2d6eaa49cfbdc /WWW/Library/Implementation/HTParse.c | |
parent | 8f8c57cc7c0e876cd291e2b4de23a52e060b30ba (diff) | |
download | lynx-snapshots-b63d287c6f3e67f8574ca2155c661288bc7dcd05.tar.gz |
snapshot of project "lynx", label v2-7-1ac_0-93
Diffstat (limited to 'WWW/Library/Implementation/HTParse.c')
-rw-r--r-- | WWW/Library/Implementation/HTParse.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c index 3c5fafc5..6f558ef5 100644 --- a/WWW/Library/Implementation/HTParse.c +++ b/WWW/Library/Implementation/HTParse.c @@ -98,6 +98,7 @@ PRIVATE void scan ARGS2( if (*p =='#') { parts->anchor = (p + 1); *p = '\0'; /* terminate the rest */ + break; /* leave things after first # alone - kw */ } } @@ -137,8 +138,12 @@ PRIVATE void scan ARGS2( * or it's an nntp or snews URL, or news URL with a host. * Restore the '#' in the address. */ - *(parts->anchor - 1) = '#'; - parts->anchor = NULL; + /* but only if we have found a path component of which this will + * become part. - kw */ + if (parts->relative || parts->absolute) { + *(parts->anchor - 1) = '#'; + parts->anchor = NULL; + } } } @@ -693,12 +698,13 @@ PUBLIC char * HTUnEscape ARGS1( return str; while (*p != '\0') { - if (*p == HEX_ESCAPE) { + if (*p == HEX_ESCAPE && + p[1] && p[2] && /* tests shouldn't be needed, but.. */ + isxdigit((unsigned char)p[1]) && + isxdigit((unsigned char)p[2])) { p++; - if (*p) - *q = from_hex(*p++) * 16; - if (*p) - *q = FROMASCII(*q + from_hex(*p++)); + *q = from_hex(*p++) * 16; + *q = FROMASCII(*q + from_hex(*p++)); q++; } else { *q++ = *p++; |