aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cgi.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-01-04 12:36:26 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-01-04 12:36:26 +0000
commit9eda08d3cc9d1228f998710fc39a87bab426a154 (patch)
tree08fc6fbbe2a2c6155d0e077fcb86f8a15900a74b /cgi.c
parent113976f693b664fe800b55c68dc6ea84908073bd (diff)
downloadmandoc-9eda08d3cc9d1228f998710fc39a87bab426a154.tar.gz
mandoc-9eda08d3cc9d1228f998710fc39a87bab426a154.tar.zst
mandoc-9eda08d3cc9d1228f998710fc39a87bab426a154.zip
Don't retain the search query in the resulting manual links.
Clean, simple URLs are best. Patch from bentley@.
Diffstat (limited to 'cgi.c')
-rw-r--r--cgi.c59
1 files changed, 3 insertions, 56 deletions
diff --git a/cgi.c b/cgi.c
index ca244532..0b01d066 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.115 2015/11/07 17:58:55 schwarze Exp $ */
+/* $Id: cgi.c,v 1.116 2016/01/04 12:36:26 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@usta.de>
@@ -63,9 +63,6 @@ static void html_print(const char *);
static void html_putchar(char);
static int http_decode(char *);
static void http_parse(struct req *, const char *);
-static void http_print(const char *);
-static void http_putchar(char);
-static void http_printquery(const struct req *, const char *);
static void pathgen(struct req *);
static void pg_error_badrequest(const char *);
static void pg_error_internal(void);
@@ -149,40 +146,6 @@ html_putchar(char c)
}
}
-static void
-http_printquery(const struct req *req, const char *sep)
-{
-
- if (NULL != req->q.query) {
- printf("query=");
- http_print(req->q.query);
- }
- if (0 == req->q.equal)
- printf("%sapropos=1", sep);
- if (NULL != req->q.sec) {
- printf("%ssec=", sep);
- http_print(req->q.sec);
- }
- if (NULL != req->q.arch) {
- printf("%sarch=", sep);
- http_print(req->q.arch);
- }
- if (strcmp(req->q.manpath, req->p[0])) {
- printf("%smanpath=", sep);
- http_print(req->q.manpath);
- }
-}
-
-static void
-http_print(const char *p)
-{
-
- if (NULL == p)
- return;
- while ('\0' != *p)
- http_putchar(*p++);
-}
-
/*
* Call through to html_putchar().
* Accepts NULL strings.
@@ -303,20 +266,6 @@ next:
}
}
-static void
-http_putchar(char c)
-{
-
- if (isalnum((unsigned char)c)) {
- putchar((unsigned char)c);
- return;
- } else if (' ' == c) {
- putchar('+');
- return;
- }
- printf("%%%.2x", c);
-}
-
/*
* HTTP-decode a string. The standard explanation is that this turns
* "%4e+foo" into "n foo" in the regular way. This is done in-place
@@ -623,9 +572,8 @@ pg_searchres(const struct req *req, struct manpage *r, size_t sz)
* without any delay.
*/
printf("Status: 303 See Other\r\n");
- printf("Location: http://%s%s/%s/%s?",
+ printf("Location: http://%s%s/%s/%s",
HTTP_HOST, scriptname, req->q.manpath, r[0].file);
- http_printquery(req, "&");
printf("\r\n"
"Content-Type: text/html; charset=utf-8\r\n"
"\r\n");
@@ -640,9 +588,8 @@ pg_searchres(const struct req *req, struct manpage *r, size_t sz)
for (i = 0; i < sz; i++) {
printf("<TR>\n"
"<TD CLASS=\"title\">\n"
- "<A HREF=\"%s/%s/%s?",
+ "<A HREF=\"%s/%s/%s",
scriptname, req->q.manpath, r[i].file);
- http_printquery(req, "&amp;");
printf("\">");
html_print(r[i].names);
printf("</A>\n"