aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man.cgi.3
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-03-15 10:17:29 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-03-15 10:17:29 +0000
commit7820a26ea52032d0330456ae02d4044b357144de (patch)
tree72770118c081a99496b5c8d7e35a16e3f17da130 /man.cgi.3
parent2c9e399563f0727410bbcdf0e023f956634dccf4 (diff)
downloadmandoc-7820a26ea52032d0330456ae02d4044b357144de.tar.gz
mandoc-7820a26ea52032d0330456ae02d4044b357144de.tar.zst
mandoc-7820a26ea52032d0330456ae02d4044b357144de.zip
It's annoying that people keep writing URIs including redundant parts
like "/OpenBSD-current/manN/". To discourage that, let man.cgi(8) redirect search form results to nice, concise URIs.
Diffstat (limited to 'man.cgi.3')
-rw-r--r--man.cgi.324
1 files changed, 21 insertions, 3 deletions
diff --git a/man.cgi.3 b/man.cgi.3
index e7c1d2fc..472d4119 100644
--- a/man.cgi.3
+++ b/man.cgi.3
@@ -1,4 +1,4 @@
-.\" $Id: man.cgi.3,v 1.2 2016/07/07 19:19:01 schwarze Exp $
+.\" $Id: man.cgi.3,v 1.3 2017/03/15 10:17:29 schwarze Exp $
.\"
.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 7 2016 $
+.Dd $Mdocdate: March 15 2017 $
.Dt MAN.CGI 3
.Os
.Sh NAME
@@ -126,12 +126,30 @@ contains a search query in short format or when
is empty and a
.Ev QUERY_STRING
is provided.
-It changes into the manpath and calls
+If possible, requests using
+.Ev QUERY_STRING
+are redirected to URIs using
+.Ev PATH_INFO
+by calling
+.Fn pg_redirect .
+Otherwise, it changes into the manpath and calls
.Xr mansearch 3 .
Depending on the result, it calls either
.Fn pg_noresult
or
.Fn pg_searchres .
+.It Ft void Fn pg_redirect "const struct req *req" "const char *name"
+This function is special in so far as it does not print an HTML page,
+but only an HTTP 303 response with a Location: of the form:
+.Sm off
+.No http://
+.Ar host Ns /
+.Op Ar scriptname Ns /
+.Op Ar manpath Ns /
+.Op Ar arch Ns /
+.Fa name
+.Op Pf . Ar sec
+.Sm on
.It Ft void Fn pg_noresult "const struct req *req" "const char *msg"
This function calls
.Fn resp_begin_html ,