aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-04-15 00:37:50 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-04-15 00:37:50 +0000
commit3049172df6f2171ad3b7ba9248f3bd16ab9a966f (patch)
treeffb5e386c283ded05545015c838ed5e428852537
parentff8805995c4600c46115ece11c83d63b9a28c1e8 (diff)
downloadmandoc-3049172df6f2171ad3b7ba9248f3bd16ab9a966f.tar.gz
mandoc-3049172df6f2171ad3b7ba9248f3bd16ab9a966f.tar.zst
mandoc-3049172df6f2171ad3b7ba9248f3bd16ab9a966f.zip
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.
-rw-r--r--cgi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cgi.c b/cgi.c
index 65ca0289..0bc4b1f4 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.123 2016/04/15 00:14:17 schwarze Exp $ */
+/* $Id: cgi.c,v 1.124 2016/04/15 00:37:50 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@usta.de>
@@ -1037,9 +1037,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);