From 48c6df47d0f3791c8f9b351188f6578ae84debe4 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Thu, 17 Jan 2002 11:06:45 +0000 Subject: [w3m-dev 02867] mark URL for external URIs * main.c (chkURLBuffer): chkExternalURIBuffer() * proto.h (chkExternalURIBuffer): added * url.c (chkExternalURIBuffer): added From: Fumitoshi UKAI --- ChangeLog | 9 ++++++++- main.c | 5 ++++- proto.h | 3 ++- url.c | 31 ++++++++++++++++++++++++++++++- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9277804..569d884 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-01-17 Fumitoshi UKAI + + * [w3m-dev 02867] mark URL for external URIs + * main.c (chkURLBuffer): chkExternalURIBuffer() + * proto.h (chkExternalURIBuffer): added + * url.c (chkExternalURIBuffer): added + 2002-01-17 Hironori Sakamoto * [w3m-dev 02866] @@ -2098,4 +2105,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.238 2002/01/17 10:29:14 ukai Exp $ +$Id: ChangeLog,v 1.239 2002/01/17 11:06:45 ukai Exp $ diff --git a/main.c b/main.c index e0ee67e..882d65f 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.64 2002/01/16 19:05:37 ukai Exp $ */ +/* $Id: main.c,v 1.65 2002/01/17 11:06:45 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include @@ -4201,6 +4201,9 @@ chkURLBuffer(Buffer *buf) NULL }; int i; +#ifdef USE_EXTERNAL_URI_LOADER + chkExternalURIBuffer(buf); +#endif for (i = 0; url_like_pat[i]; i++) { reAnchor(buf, url_like_pat[i]); } diff --git a/proto.h b/proto.h index 8722927..cf0627c 100644 --- a/proto.h +++ b/proto.h @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.26 2002/01/16 16:49:54 ukai Exp $ */ +/* $Id: proto.h,v 1.27 2002/01/17 11:06:45 ukai Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -113,6 +113,7 @@ extern char *filename_extension(char *patch, int is_url); #ifdef USE_EXTERNAL_URI_LOADER extern void initURIMethods(); extern Str searchURIMethods(ParsedURL *pu); +extern void chkExternalURIBuffer(Buffer *buf); #endif extern void examineFile(char *path, URLFile *uf); extern char *acceptableEncoding(); diff --git a/url.c b/url.c index 5913adc..e9fecd5 100644 --- a/url.c +++ b/url.c @@ -1,4 +1,4 @@ -/* $Id: url.c,v 1.34 2002/01/15 03:45:02 ukai Exp $ */ +/* $Id: url.c,v 1.35 2002/01/17 11:06:45 ukai Exp $ */ #include "fm.h" #include #include @@ -2068,4 +2068,33 @@ searchURIMethods(ParsedURL *pu) } return NULL; } + +/* + * RFC2396: Uniform Resource Identifiers (URI): Generic Syntax + * Appendix A. Collected BNF for URI + * uric = reserved | unreserved | escaped + * reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | + * "$" | "," + * unreserved = alphanum | mark + * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | + * "(" | ")" + * escaped = "%" hex hex + */ + +#define URI_PATTERN "[-;/?:@&=+$,a-zA-Z0-9_.!~*'()%]*" +void +chkExternalURIBuffer(Buffer *buf) +{ + int i; + struct table2 *ump; + + for (i = 0; (ump = urimethods[i]) != NULL; i++) { + for (; ump->item1 != NULL; ump++) { + reAnchor(buf, Sprintf("%s:" URI_PATTERN, ump->item1)->ptr); + } + } + for (ump = default_urimethods; ump->item1 != NULL; ump++) { + reAnchor(buf, Sprintf("%s:" URI_PATTERN, ump->item1)->ptr); + } +} #endif -- cgit v1.2.3