summaryrefslogtreecommitdiffstats
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
commit7f62257df910dabf75acbc931ba339de0abde743 (patch)
tree095d82d829b86866f6d5eda286d66fb446b50561 /man.cgi.3
parent1868a0d4224f0f94adf4fa7d103cf10e2020f5ea (diff)
downloadmandoc-7f62257df910dabf75acbc931ba339de0abde743.tar.gz
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.320
1 files changed, 19 insertions, 1 deletions
diff --git a/man.cgi.3 b/man.cgi.3
index b7901058..de353390 100644
--- a/man.cgi.3
+++ b/man.cgi.3
@@ -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 ,