commit fee6beb502b6093d7dc7e8ba52811c4b4fe26a8d
parent 09a8d1f9866c896962e0ef1dc86baf25b4220cf4
Author: ukai <ukai>
Date: Thu, 17 Jan 2002 11:06:45 +0000
[w3m-dev 02867] mark URL for external URIs
* main.c (chkURLBuffer): chkExternalURIBuffer()
* proto.h (chkExternalURIBuffer): added
* url.c (chkExternalURIBuffer): added
From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat:
4 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,10 @@
+2002-01-17 Fumitoshi UKAI <ukai@debian.or.jp>
+
+ * [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 <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 02866]
diff --git a/main.c b/main.c
@@ -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
@@ -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
@@ -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