=================================================================== RCS file: /cvs/mandoc/cgi.c,v retrieving revision 1.120 retrieving revision 1.122 diff -u -p -r1.120 -r1.122 --- mandoc/cgi.c 2016/04/13 15:38:45 1.120 +++ mandoc/cgi.c 2016/04/14 23:48:48 1.122 @@ -1,4 +1,4 @@ -/* $Id: cgi.c,v 1.120 2016/04/13 15:38:45 schwarze Exp $ */ +/* $Id: cgi.c,v 1.122 2016/04/14 23:48:48 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2016 Ingo Schwarze @@ -55,6 +55,7 @@ struct req { struct query q; char **p; /* array of available manpaths */ size_t psz; /* number of available manpaths */ + int isquery; /* QUERY_STRING used, not PATH_INFO */ }; static void catman(const struct req *, const char *); @@ -188,6 +189,7 @@ http_parse(struct req *req, const char *qs) char *key, *val; size_t keysz, valsz; + req->isquery = 1; req->q.manpath = NULL; req->q.arch = NULL; req->q.sec = NULL; @@ -568,7 +570,7 @@ pg_searchres(const struct req *req, struct manpage *r, return; } - if (1 == sz) { + if (req->isquery && sz == 1) { /* * If we have just one result, then jump there now * without any delay. @@ -814,12 +816,8 @@ format(const struct req *req, const char *file) memset(&conf, 0, sizeof(conf)); conf.fragment = 1; usepath = strcmp(req->q.manpath, req->p[0]); - mandoc_asprintf(&conf.man, "/%s?query=%%N&sec=%%S%s%s%s%s", - scriptname, - req->q.arch ? "&arch=" : "", - req->q.arch ? req->q.arch : "", - usepath ? "&manpath=" : "", - usepath ? req->q.manpath : ""); + mandoc_asprintf(&conf.man, "/%s%s%%N.%%S", + usepath ? req->q.manpath : "", usepath ? "/" : ""); mparse_result(mp, &man, NULL); if (man == NULL) { @@ -1085,6 +1083,7 @@ path_parse(struct req *req, const char *path) { int dir_done; + req->isquery = 0; req->q.equal = 1; req->q.manpath = mandoc_strdup(path);