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

Julian Reschke wrote:
> ...
> I have opened <http://trac.tools.ietf.org/wg/httpbis/trac/ticket/163>, 
> tracking this.
> ...

I produced a proposed change that rearranges the ABNF, renames some of 
the productions for consistency with RFC5322, and refers to RFC5322 for 
their semantics -- see 
<http://trac.tools.ietf.org/wg/httpbis/trac/attachment/ticket/163/163.diff> 
and 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.

       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.

    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

      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).

      obs-date     = rfc850-date / asctime-date
      rfc850-date  = day-name-l "," SP date2 SP time-of-day SP GMT
      asctime-date = day-name SP date3 SP time-of-day SP 4DIGIT

      date2        = 2DIGIT "-" month "-" 2DIGIT
                     ; day-month-year (e.g., 02-Jun-82)
      date3        = month SP ( 2DIGIT / ( SP 1DIGIT ))
                     ; month day (e.g., Jun  2)
      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

    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 --


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).

BR, Julian

Received on Friday, 8 May 2009 12:30:50 UTC