From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-02.scc.kit.edu (scc-mailout-kit-02.scc.kit.edu [129.13.231.82]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id b5e419e6 for ; Fri, 25 Dec 2015 09:58:56 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-02.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1aCTpT-0004TK-QM; Fri, 25 Dec 2015 15:58:53 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1aCTpT-0000q0-NI; Fri, 25 Dec 2015 15:58:51 +0100 Received: from athene.usta.de ([172.24.96.10]) by donnerwolke.usta.de with esmtp (Exim 4.84) (envelope-from ) id 1aCTZe-0005s2-Jj; Fri, 25 Dec 2015 15:42:30 +0100 Received: from localhost (1031@localhost [local]); by localhost (OpenSMTPD) with ESMTPA id 210a08d7; Fri, 25 Dec 2015 15:58:51 +0100 (CET) Date: Fri, 25 Dec 2015 15:58:51 +0100 From: Ingo Schwarze To: "Anthony J. Bentley" Cc: tech@mdocml.bsd.lv Subject: Re: man.cgi: don't add query strings to search results Message-ID: <20151225145851.GH3859@athene.usta.de> References: <13857.1450966617@CATHET.us> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13857.1450966617@CATHET.us> User-Agent: Mutt/1.5.23 (2014-03-12) Hi Anthony, Anthony J. Bentley wrote on Thu, Dec 24, 2015 at 07:16:57AM -0700: > After performing a search, man.cgi adds the query string to the > resulting URL (if there's a single result) or to each link in the > search results (if more than one). > > I believe that here the query string is just clutter. If I want the > query string after clicking a link in the multiple-results case, I > can just hit the back button to return to the results page, which > still contains the query in its own URL and in the search box. If > I want the query string after getting an unambiguous result... well, > I can't imagine wanting that. But even so, browsers like Firefox > will still retain the query in that case too if I hit back. No benefit > to keeping it on the destination page. > > And I really think the benefit of clean, simple URLs by default for > the most common case--linking to individual manuals--can't be > overstated. Nice simplification. Please commit, OK schwarze@. I'll merge to bsd.lv after that. Yours, Ingo > Index: cgi.c > =================================================================== > RCS file: /cvs/mdocml/cgi.c,v > retrieving revision 1.115 > diff -u -p -r1.115 cgi.c > --- cgi.c 7 Nov 2015 17:58:55 -0000 1.115 > +++ cgi.c 24 Dec 2015 13:49:40 -0000 > @@ -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, stru > * 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, stru > for (i = 0; i < sz; i++) { > printf("\n" > "\n" > - " + " scriptname, req->q.manpath, r[i].file); > - http_printquery(req, "&"); > printf("\">"); > html_print(r[i].names); > printf("\n" -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv