summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-04-15 00:36:19 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-04-15 00:36:19 +0000
commit947c4332952ac7af7e63b314be47da0c398d7b86 (patch)
tree038ee4e77f0efe4adfd5b80f0f4643c2bedbb520 /usr.bin
parent1d7089832ee47e352e57929e3f2742ff18befb93 (diff)
If PATH_INFO contains a complete and correct path to a manual page
file, for example "/OpenBSD-5.9/man2/pledge.2", no database query is needed and the file is delivered directly. But even in this case, let's parse the PATH_INFO and fill the query structure such that the search form at the top of the result page gets pre-filled with useful values.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/cgi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/mandoc/cgi.c b/usr.bin/mandoc/cgi.c
index b661f02ccdf..c163866a5b7 100644
--- a/usr.bin/mandoc/cgi.c
+++ b/usr.bin/mandoc/cgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgi.c,v 1.62 2016/04/15 00:12:50 schwarze Exp $ */
+/* $OpenBSD: cgi.c,v 1.63 2016/04/15 00:36:18 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@usta.de>
@@ -1035,9 +1035,10 @@ main(void)
else if (*path == '/')
path++;
- if (*path != '\0' && access(path, F_OK) == -1) {
+ if (*path != '\0') {
path_parse(&req, path);
- path = "";
+ if (access(path, F_OK) == -1)
+ path = "";
} else if ((querystring = getenv("QUERY_STRING")) != NULL)
http_parse(&req, querystring);