Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/httpd A filename with a colon in it made it appear t...



details:   https://anonhg.NetBSD.org/src/rev/068f024d872e
branches:  trunk
changeset: 763120:068f024d872e
user:      reed <reed%NetBSD.org@localhost>
date:      Thu Mar 10 14:39:40 2011 +0000

description:
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.

diffstat:

 libexec/httpd/dir-index-bozo.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r 32799e6b46c1 -r 068f024d872e libexec/httpd/dir-index-bozo.c
--- a/libexec/httpd/dir-index-bozo.c    Thu Mar 10 14:37:16 2011 +0000
+++ b/libexec/httpd/dir-index-bozo.c    Thu Mar 10 14:39:40 2011 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index