From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Hartwig Newsgroups: gmane.lisp.guile.bugs Subject: bug#10147: HTTP "Expires" header should handle non-date values Date: Tue, 27 Dec 2011 23:49:00 +0800 Message-ID: References: <87ty4tqpyf.fsf@pobox.com> <87hb0srdgz.fsf@pobox.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=e89a8f234aad65f89104b514d2af X-Trace: dough.gmane.org 1325000975 8230 80.91.229.12 (27 Dec 2011 15:49:35 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Dec 2011 15:49:35 +0000 (UTC) Cc: guile-user@gnu.org, 10147@debbugs.gnu.org To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Dec 27 16:49:31 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RfZHO-0007sA-B6 for guile-bugs@m.gmane.org; Tue, 27 Dec 2011 16:49:30 +0100 Original-Received: from localhost ([::1]:36623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RfZHN-0005Se-Sw for guile-bugs@m.gmane.org; Tue, 27 Dec 2011 10:49:29 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:43723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RfZHK-0005SK-6Q for bug-guile@gnu.org; Tue, 27 Dec 2011 10:49:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RfZHH-0001yl-Fl for bug-guile@gnu.org; Tue, 27 Dec 2011 10:49:26 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54786) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RfZHH-0001yh-Ah for bug-guile@gnu.org; Tue, 27 Dec 2011 10:49:23 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RfZJp-0006gh-Pj for bug-guile@gnu.org; Tue, 27 Dec 2011 10:52:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Hartwig Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 27 Dec 2011 15:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10147 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch Original-Received: via spool by 10147-submit@debbugs.gnu.org id=B10147.132500110225676 (code B ref 10147); Tue, 27 Dec 2011 15:52:01 +0000 Original-Received: (at 10147) by debbugs.gnu.org; 27 Dec 2011 15:51:42 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RfZJV-0006g5-Tv for submit@debbugs.gnu.org; Tue, 27 Dec 2011 10:51:42 -0500 Original-Received: from mail-gx0-f172.google.com ([209.85.161.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RfZJU-0006fy-DQ for 10147@debbugs.gnu.org; Tue, 27 Dec 2011 10:51:41 -0500 Original-Received: by ggnk5 with SMTP id k5so7486864ggn.3 for <10147@debbugs.gnu.org>; Tue, 27 Dec 2011 07:49:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=lW8YtKrO9WqhKN0/V2e079DEQ2C4E9xlCVoNe8duqZw=; b=AYrViHFWo2HW+CYzPjkIexhQwRDmCmAmnCe6gU7TZhilk4a04X5+n1ydHa655YMkgr 8yrsigNV7A6oiJ6NSZAc9cWpOtOlXC4yQ4lWPtX+3fnyglfqHg+JVU4exEm3Cn73vT67 QNhC8cPXs+uBHFlZ9r2iI2jFMuKwxtQ/L4SiI= Original-Received: by 10.50.156.138 with SMTP id we10mr11629777igb.10.1325000940713; Tue, 27 Dec 2011 07:49:00 -0800 (PST) Original-Received: by 10.231.48.68 with HTTP; Tue, 27 Dec 2011 07:49:00 -0800 (PST) In-Reply-To: <87hb0srdgz.fsf@pobox.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 27 Dec 2011 10:52:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6017 Archived-At: --e89a8f234aad65f89104b514d2af Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 22 December 2011 20:35, Andy Wingo wrote: >> Not sure precisely what you mean here. =A0Is it something like: >> >> (or (false-if-exception (parse-date str)) >> =A0 =A0 (and (memq str '("0" "-1")) str) >> =A0 =A0 date-in-the-past) > > More like: > > =A0(if (member str '("0" "-1")) > =A0 =A0 =A0date-in-the-past > =A0 =A0 =A0(parse-date str)) > > Then we can wait and see -- if only these two values are out there, then > we are good, and we keep the "validating" characteristic of our date > parser. =A0Otherwise we can fall back to the false-if-exception dance if > someone submits a bug report. A rough check against ~2600 sites scraped from dmoz.org shows only a handful with other values. These two: "Mon, 12 Jul 1996 1:00:00 GMT" ^ misses leading `0' "Thu, 01 Jan 1970 00:00:00 +0000" ^ should be `GMT' The second (use of `+0000') was also encountered amongst other date-valued headers in ~1% of pages sampled. There might be a case here for relaxing `parse-date' as I don't think these should be handled specifically for "Expires" headers. There were three more like: "{ts '2011-12-27 08:12:22'}" which only appeared for "Expires" headers. They look something like server directives which should have been transformed to legit expiration dates but haven't been, due to misconfiguration. In this case I'd rather throw an error than parse it (wrongly) to date-in-the-past. Given those points, I have attached a patch implementing the suggested handling for "Expires" and will take a look at perhaps relaxing parse-date (and others). Anyone have ideas on that? Daniel --e89a8f234aad65f89104b514d2af Content-Type: text/x-patch; charset=US-ASCII; name="0001-permit-non-date-values-for-Expires-header.patch" Content-Disposition: attachment; filename="0001-permit-non-date-values-for-Expires-header.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gwp37ai00 RnJvbSA4YjdlZGEwYmQ3YjAzNDY3ZjZlZWYwY2U2Yzk5ZGVkZjhmZDNhYzBjIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBEYW5pZWwgSGFydHdpZyA8bWFuZHlrZUBnbWFpbC5jb20+CkRh dGU6IFR1ZSwgMjcgRGVjIDIwMTEgMjI6MjQ6MjggKzA4MDAKU3ViamVjdDogW1BBVENIXSBwZXJt aXQgbm9uLWRhdGUgdmFsdWVzIGZvciBFeHBpcmVzIGhlYWRlcgoKKiBtb2R1bGUvd2ViL2h0dHAu c2NtICgiRXhwaXJlcyIpOiBQZXJtaXQgKHNvbWUpIG5vbi1kYXRlIHZhbHVlcy4KLS0tCiBtb2R1 bGUvd2ViL2h0dHAuc2NtIHwgICAxMCArKysrKysrKystCiAxIGZpbGVzIGNoYW5nZWQsIDkgaW5z ZXJ0aW9ucygrKSwgMSBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9tb2R1bGUvd2ViL2h0dHAu c2NtIGIvbW9kdWxlL3dlYi9odHRwLnNjbQppbmRleCBhZmU3MGE3Li45YmI0NDQ5IDEwMDY0NAot LS0gYS9tb2R1bGUvd2ViL2h0dHAuc2NtCisrKyBiL21vZHVsZS93ZWIvaHR0cC5zY20KQEAgLTE1 MDYsNyArMTUwNiwxNSBAQCBwaHJhc2VcIi4iCiAKIDs7IEV4cGlyZXMgPSBIVFRQLWRhdGUKIDs7 Ci0oZGVjbGFyZS1kYXRlLWhlYWRlciEgIkV4cGlyZXMiKQorKGRlZmluZSAqZGF0ZS1pbi10aGUt cGFzdCogKHBhcnNlLWRhdGUgIlRodSwgMDEgSmFuIDE5NzAgMDA6MDA6MDAgR01UIikpCisKKyhk ZWNsYXJlLWhlYWRlciEgIkV4cGlyZXMiCisgIChsYW1iZGEgKHN0cikKKyAgICAoaWYgKG1lbWJl ciBzdHIgJygiMCIgIi0xIikpCisgICAgICAgICpkYXRlLWluLXRoZS1wYXN0KgorICAgICAgICAo cGFyc2UtZGF0ZSBzdHIpKSkKKyAgZGF0ZT8KKyAgd3JpdGUtZGF0ZSkKIAogOzsgTGFzdC1Nb2Rp ZmllZCA9IEhUVFAtZGF0ZQogOzsKLS0gCjEuNy41LjQKCg== --e89a8f234aad65f89104b514d2af--