summaryrefslogtreecommitdiffstats
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
commitaabc253c10f7058df3c88983f91acceedb786ffb (patch)
treea835326d4c8bd085723d73725e1c141a21a2e8bb
parent7ccf676d918d4d24100f3b87a668afd042dc5de3 (diff)
downloadmandoc-aabc253c10f7058df3c88983f91acceedb786ffb.tar.gz
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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cgi.c b/cgi.c
index c622d9ec..9e072116 100644
--- a/cgi.c
+++ b/cgi.c
@@ -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);