From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id 0de64ecb for ; Thu, 24 Dec 2015 09:17:00 -0500 (EST) Received: by mail-ob0-f178.google.com with SMTP id 18so186367076obc.2 for ; Thu, 24 Dec 2015 06:17:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cathet-us.20150623.gappssmtp.com; s=20150623; h=sender:from:to:subject:mime-version:content-type:content-id:date :message-id; bh=oXU4KkJXQBzW67SB0v0LrT6Zzkv7eBKqih+/GH2q8fM=; b=jm7yK1du56UqrUaFig1t+pmWZ590SNcahSLcf8VJppo47MgR79GBqSx5/rHJTtJQl9 /aLnwA/J8ybdFmeMkA8+adKPiC4Ut8Vwrkv0iN3L23KkztWIlY053U4kSjaGqG7QKZhS MEdhWCtT04vRkkm/jV/BlZc9FqZU9kW9Nthax5KJZONLY9I8WLmOScg/J78QLP8z0UaT 8S8JRuwwvYo13+TUeDRBWZsKOAQ29AuOg/u4Ct/J0YyAGa4+HY9j1IB5twPB+Aou6knG FwrlVPrTxPuW63ZxXdyMz9bOp8dYEfwqEzZ9FhcAja96YtXcDPnokfpUuLfOAusJJovS RUTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:mime-version:content-type :content-id:date:message-id; bh=oXU4KkJXQBzW67SB0v0LrT6Zzkv7eBKqih+/GH2q8fM=; b=hnmFsnG0tw3kTKc9cW8Yc1bgRh4JMQ7O4MSO0ssqDuGD33TlO/4kh02Qt3cFXH1Utr ofMgrYxURM4m+PsmXZP3SWUt8ODv4zxvxciFT2Dhj+g1SsW4bIJhoVGtYd9Wuqa/HSwQ 62se57RUo1TMP8YJqBCWAnLIqRfiV42zVYAuemfHABbV8tWR4QeQrLZCvMygtRQh8ZHX MH7RQH2aLFvFCPajoOVdhgr1FivYGESLqaGBEU4IzdhfArl8W0F8f42a2boUZkH3ysKg 5mB1b9ifaMhdETAXn7sjgONJ5Uz6gjSBDRBYq63WVhY0EMiLiSKrwTyjIdzN/pvYsyIF 29TQ== X-Gm-Message-State: ALoCoQmGwtEltxVLDtBswEc+eQpXI5r74GG3U88xXoQ0VqQmeWOlumfaw01QaS8hop856YyV4BfPNE3dXN6hMAKSVtz1zJ8Jog== X-Received: by 10.60.159.72 with SMTP id xa8mr18648806oeb.25.1450966619065; Thu, 24 Dec 2015 06:16:59 -0800 (PST) Received: from cathet.us. (75-161-65-245.albq.qwest.net. [75.161.65.245]) by smtp.gmail.com with ESMTPSA id sd7sm7018418oec.13.2015.12.24.06.16.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Dec 2015 06:16:58 -0800 (PST) Sender: "Anthony J. Bentley" Received: from CATHET.us (localhost [127.0.0.1]) by cathet.us. (OpenSMTPD) with ESMTP id 0f33fda7 for ; Thu, 24 Dec 2015 07:16:57 -0700 (MST) From: "Anthony J. Bentley" To: tech@mdocml.bsd.lv Subject: man.cgi: don't add query strings to search results X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26421.1450966617.1@CATHET.us> Date: Thu, 24 Dec 2015 07:16:57 -0700 Message-ID: <13857.1450966617@CATHET.us> Hi, 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. 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" - "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