W3C home > Mailing lists > Public > ietf-http-wg@w3.org > April to June 2009

Re: Issue 163, was: Meaning of invalid but well-formed dates

From: Julian Reschke <julian.reschke@gmx.de>
Date: Fri, 08 May 2009 20:06:01 +0200
Message-ID: <4A047489.2070803@gmx.de>
To: Brian Smith <brian@briansmith.org>
CC: 'Geoffrey Sneddon' <foolistbar@googlemail.com>, 'HTTP Working Group' <ietf-http-wg@w3.org>
Brian Smith wrote:
> Julian Reschke wrote:
>> 3.2.  Date/Time Formats
>>     The first format is preferred as an Internet standard and
>>     represents a fixed-length subset of that defined by
>>     [RFC1123].
> 
> I still think it is misleading to refer to RFC1123 here when HTTP doesn't
> use the syntax or the semantics of RFC1123. Besides, the specification
> doesn't have to justify why the that syntax is preferred. The next paragraph
> already states that implementations MUST use it. I'd just delete that
> paragraph.

I think it's useful to understand why HTTP/1.1 happens to use this format.

> I don't get why s-Mon, s-Jan, l-Mon, etc. are named productions (instead of
> unnamed alternatives like in RFC 5023), but that is not new to this change.

For readability; our version is case-sensitive, so we can't use string 
constants in the ABNF.

> The semantics of the obsolete date formats are not defined. How is a server
> supposed to interpret a 2-digit year? 

Good question. Do you have an answer? Can we mandate the rules in 
<http://tools.ietf.org/html/rfc5322#section-4.3>?

>>       asctime-date = day-name SP date3 SP time-of-day SP 4DIGIT
>>       date2        = 2DIGIT "-" month "-" 2DIGIT
>>                      ; day-month-year (e.g., 02-Jun-82)
> 
> Might as well use "day" and "year":

We can re-use "day", but not "year" (because it's 4DIGIT).

>         asctime-date = day-name SP date3 SP time-of-day SP year
>         date2        = day "-" month "-" 2DIGIT
>                        ; day-month-year (e.g., 02-Jun-82)
> 
>> Note: HTTP requirements for the date/time stamp format apply only to
>> their usage within the protocol stream.  Clients and servers are not
>> required to use these formats for user presentation, request logging,
>> etc.
> 
> Might as well delete this while you are at it. It is strange to single out
> that this one part of the HTTP syntax doesn't have to be used outside of the
> protocol, when that is generally true for all parts of the syntax.

I think I agree, but I'd like to avoid taking out stuff without more review.

>> While at it, we probably should also drop the surplus subsection 3.2.1
>> and move all of this into 3.2 (this is a left-over from partitioning
>> RFC 2616).
> 
> +1.

Will do that when the patch gets applied. In the meantime I have 
re-arranged stuff a bit more so that it's more clear what belongs to 
which format, and which ones are preferred/obsolete; and also moved the 
other note to the end of the paragraph. See 
<http://trac.tools.ietf.org/wg/httpbis/trac/attachment/ticket/163/163.diff> 
and full text below:

-- snip --
3.2.  Date/Time Formats

3.2.1.  Full Date

    HTTP applications have historically allowed three different formats
    for the representation of date/time stamps:

      Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 1123
      Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format
      Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format

    The first format is preferred as an Internet standard and represents
    a fixed-length subset of that defined by [RFC1123].  The other
    formats are described here only for compatibility with obsolete
    implementations.  HTTP/1.1 clients and servers that parse the date
    value MUST accept all three formats (for compatibility with
    HTTP/1.0), though they MUST only generate the RFC 1123 format for
    representing HTTP-date values in header fields.  See Appendix A for
    further information.

    All HTTP date/time stamps MUST be represented in Greenwich Mean Time
    (GMT), without exception.  For the purposes of HTTP, GMT is exactly
    equal to UTC (Coordinated Universal Time).  This is indicated in the
    first two formats by the inclusion of "GMT" as the three-letter
    abbreviation for time zone, and MUST be assumed when reading the
    asctime format.  HTTP-date is case sensitive and MUST NOT include
    additional whitespace beyond that specifically included as SP in the
    grammar.

      HTTP-date    = rfc1123-date / obs-date

    Preferred format:

      rfc1123-date = day-name "," SP date1 SP time-of-day SP GMT

      day-name     = s-Mon / s-Tue / s-Wed
                   / s-Thu / s-Fri / s-Sat / s-Sun

      s-Mon = %x4D.6F.6E ; "Mon", case-sensitive
      s-Tue = %x54.75.65 ; "Tue", case-sensitive
      s-Wed = %x57.65.64 ; "Wed", case-sensitive
      s-Thu = %x54.68.75 ; "Thu", case-sensitive
      s-Fri = %x46.72.69 ; "Fri", case-sensitive
      s-Sat = %x53.61.74 ; "Sat", case-sensitive
      s-Sun = %x53.75.6E ; "Sun", case-sensitive

      date1        = day SP month SP year
                   ; e.g., 02 Jun 1982

      day          = 2DIGIT
      month        = s-Jan / s-Feb / s-Mar / s-Apr
                   / s-May / s-Jun / s-Jul / s-Aug
                   / s-Sep / s-Oct / s-Nov / s-Dec
      year         = 4DIGIT

      s-Jan = %x4A.61.6E ; "Jan", case-sensitive
      s-Feb = %x46.65.62 ; "Feb", case-sensitive
      s-Mar = %x4D.61.72 ; "Mar", case-sensitive
      s-Apr = %x41.70.72 ; "Apr", case-sensitive
      s-May = %x4D.61.79 ; "May", case-sensitive
      s-Jun = %x4A.75.6E ; "Jun", case-sensitive
      s-Jul = %x4A.75.6C ; "Jul", case-sensitive
      s-Aug = %x41.75.67 ; "Aug", case-sensitive
      s-Sep = %x53.65.70 ; "Sep", case-sensitive
      s-Oct = %x4F.63.74 ; "Oct", case-sensitive
      s-Nov = %x4E.6F.76 ; "Nov", case-sensitive
      s-Dec = %x44.65.63 ; "Dec", case-sensitive

      GMT   = %x47.4D.54 ; "GMT", case-sensitive

      time-of-day  = hour ":" minute ":" second
                     ; 00:00:00 - 23:59:59

      hour         = 2DIGIT
      minute       = 2DIGIT
      second       = 2DIGIT

    The semantics of day-name, day, month, year, and time-of-day are the
    same as those defined in the RFC 5322 constructs with the
    corresponding name ([RFC5322], Section 3.3).

    Obsolete formats:

      obs-date     = rfc850-date / asctime-date


      rfc850-date  = day-name-l "," SP date2 SP time-of-day SP GMT
      date2        = day "-" month "-" 2DIGIT
                     ; day-month-year (e.g., 02-Jun-82)

      day-name-l   = l-Mon / l-Tue / l-Wed
                   / l-Thu / l-Fri / l-Sat / l-Sun

      l-Mon = %x4D.6F.6E.64.61.79          ; "Monday", case-sensitive
      l-Tue = %x54.75.65.73.64.61.79       ; "Tuesday", case-sensitive
      l-Wed = %x57.65.64.6E.65.73.64.61.79 ; "Wednesday", case-sensitive
      l-Thu = %x54.68.75.72.73.64.61.79    ; "Thursday", case-sensitive
      l-Fri = %x46.72.69.64.61.79          ; "Friday", case-sensitive
      l-Sat = %x53.61.74.75.72.64.61.79    ; "Saturday", case-sensitive
      l-Sun = %x53.75.6E.64.61.79          ; "Sunday", case-sensitive


      asctime-date = day-name SP date3 SP time-of-day SP year
      date3        = month SP ( 2DIGIT / ( SP 1DIGIT ))
                     ; month day (e.g., Jun  2)

       Note: Recipients of date values are encouraged to be robust in
       accepting date values that may have been sent by non-HTTP
       applications, as is sometimes the case when retrieving or posting
       messages via proxies/gateways to SMTP or NNTP.

       Note: HTTP requirements for the date/time stamp format apply only
       to their usage within the protocol stream.  Clients and servers
       are not required to use these formats for user presentation,
       request logging, etc.
-- snip --

Best regards, Julian
Received on Friday, 8 May 2009 18:06:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 27 April 2012 06:51:02 GMT