[PATCH] making ngx_http_parse_time support 1 digit day
wandenberg at gmail.com
Fri Nov 9 16:33:33 UTC 2012
thanks for you explanation.
Only one doubt, the rfc2616 on the same paragraph says
"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 <http://tools.ietf.org/html/rfc1123> format for
representing HTTP-date values in header fields. See section
This isn't the case for relax the parser? We are parsing dates.
On Fri, Nov 9, 2012 at 1:53 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> On Fri, Nov 09, 2012 at 12:37:50PM -0200, Wandenberg Peixoto wrote:
> > I was checking a strange behavior when parsing dates coming from
> > browsers with this function and observed that it not supports dates with
> > only one digit, it expect that the date comes with 01, 02, 03 ...
> > But as rfc822 and rfc2822 says the day can be 1, 2 , 3, ... 10, 15, ...
> > So I am proposing this patch to be compliant with the rfc.
> What nginx supports is specified here:
> This includes support for 1-digit years as per asctime() format.
> Format which is subset of date format defined by RFC 1123 (RFC822)
> require two digits as per syntax.
> That is, nginx is perfectly RFC complaint - you just looking at
> wrong RFC.
> Just for reference, here are the syntax provided in RFC 2616:
> HTTP-date = rfc1123-date | rfc850-date | asctime-date
> rfc1123-date = wkday "," SP date1 SP time SP "GMT"
> rfc850-date = weekday "," SP date2 SP time SP "GMT"
> asctime-date = wkday SP date3 SP time SP 4DIGIT
> date1 = 2DIGIT SP month SP 4DIGIT
> ; day month year (e.g., 02 Jun 1982)
> date2 = 2DIGIT "-" month "-" 2DIGIT
> ; day-month-year (e.g., 02-Jun-82)
> date3 = month SP ( 2DIGIT | ( SP 1DIGIT ))
> ; month day (e.g., Jun 2)
> > I expect that this patch could be applied to nginx code.
> I don't think it's a good idea to relax parsing beyond what
> RFC 2616 requires unless there is really good reason to.
> Maxim Dounin
> nginx-devel mailing list
> nginx-devel at nginx.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nginx-devel