Module Name: src
Committed By: reed
Date: Thu Mar 10 14:39:40 UTC 2011
Modified Files:
src/libexec/httpd: dir-index-bozo.c
Log Message:
A filename with a colon in it made it appear to be the URI scheme
to various web browsers. So follow RFC 3986 4.2 and prepend ./
to the filename in the generated index hyperlink.
Okayed by mrg.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/libexec/httpd/dir-index-bozo.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/libexec/httpd/dir-index-bozo.c
diff -u src/libexec/httpd/dir-index-bozo.c:1.11 src/libexec/httpd/dir-index-bozo.c:1.12
--- src/libexec/httpd/dir-index-bozo.c:1.11 Mon Sep 20 23:11:38 2010
+++ src/libexec/httpd/dir-index-bozo.c Thu Mar 10 14:39:40 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dir-index-bozo.c,v 1.11 2010/09/20 23:11:38 mrg Exp $ */
+/* $NetBSD: dir-index-bozo.c,v 1.12 2011/03/10 14:39:40 reed Exp $ */
/* $eterna: dir-index-bozo.c,v 1.18 2010/09/20 22:26:29 mrg Exp $ */
@@ -145,6 +145,10 @@
} else if (S_ISDIR(sb.st_mode)) {
bozo_printf(httpd, "<a href=\"%s/\">", name);
l += bozo_printf(httpd, "%s/", name);
+ } else if (strchr(name, ':') != NULL) {
+ /* RFC 3986 4.2 */
+ bozo_printf(httpd, "<a href=\"./%s\">", name);
+ l += bozo_printf(httpd, "%s", name);
} else {
bozo_printf(httpd, "<a href=\"%s\">", name);
l += bozo_printf(httpd, "%s", name);