unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Daniel Hartwig <mandyke@gmail.com>
Cc: "R. P. Dillon" <rpdillon@gmail.com>,
	guile-user@gnu.org, 10147@debbugs.gnu.org
Subject: bug#10147: HTTP "Expires" header should handle non-date values
Date: Wed, 21 Dec 2011 21:51:04 -0500	[thread overview]
Message-ID: <87ty4tqpyf.fsf@pobox.com> (raw)
In-Reply-To: <CAN3veRcj__twTi8nXKaEqNFrEmwOa2rhBEwmXLq-BV5dpXzApA@mail.gmail.com> (Daniel Hartwig's message of "Sun, 27 Nov 2011 18:39:12 +0800")

Hi Daniel,

So sorry for the delay.

On Sun 27 Nov 2011 05:39, Daniel Hartwig <mandyke@gmail.com> writes:

> This is definitely a bug on Guile's part, HTTP/1.1 permits such values
> for "Expires" headers [1], treating them as though they were a date in
> the past:
>
>    HTTP/1.1 clients and caches MUST treat other invalid date formats,
>    especially including the value "0", as in the past (i.e., "already
>    expired").
>
> [1] http://tools.ietf.org/html/rfc2616#section-14.21

But that's right after saying

   The format is an absolute date and time as defined by HTTP-date in
   section 3.3.1; it MUST be in RFC 1123 date format:

      Expires = "Expires" ":" HTTP-date

But, pragmatism may rule, here...

> Attached patch permits non-date values for "Expires", leaving them as
> strings (preferable, as such responses can be transparently forwarded
> to other clients). The staleness of a response could be determined
> quite crudely, e.g.
>
> (define (response-stale? r)
>   (let ((expires (response-expires r)))
>     (and expires
>          (or (not (date? expires)) ;; Indicates already expired.
>              (time<=? (date->time-utc expires)
>                       (current-time))))))

Let us assume that it is a good idea to include this hack.  Wouldn't it
be better to keep the expires header as a date?  Would any date in the
past work fine?

Would it be best to allow some special cases like "0" or "-1" instead?

I'm just trying to limit the damage here :)  WDYT?

Andy
-- 
http://wingolog.org/





  reply	other threads:[~2011-12-22  2:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-27 10:39 HTTP "Expires" header should handle non-date values Daniel Hartwig
2011-12-22  2:51 ` Andy Wingo [this message]
2011-12-22  4:28   ` bug#10147: " Daniel Hartwig
2011-12-22 12:35     ` Andy Wingo
2011-12-27 15:49       ` Daniel Hartwig
     [not found]       ` <CAN3veRfgg+dDzjMy1L8xaAcaZ82dAuFM1dnNpGbzq-5ckoVsAA@mail.gmail.com>
2012-01-09 22:36         ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ty4tqpyf.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=10147@debbugs.gnu.org \
    --cc=guile-user@gnu.org \
    --cc=mandyke@gmail.com \
    --cc=rpdillon@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).