Welcome! Log In Create A New Profile

Advanced

[PATCH] making ngx_http_parse_time support 1 digit day

November 09, 2012 09:38AM
Hello!

I was checking a strange behavior when parsing dates coming from different
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.

I expect that this patch could be applied to nginx code.

--- src/http/ngx_http_parse_time.c 2012-02-28 08:31:05.000000000 -0300
+++ src/http/ngx_http_parse_time.c 2012-11-09 11:38:38.664036971 -0200
@@ -54,12 +54,17 @@ ngx_http_parse_time(u_char *value, size_
}

if (fmt != isoc) {
- if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') {
+ if (*p < '0' || *p > '9' || ((*(p + 1) != ' ') && (*(p + 1) < '0'
|| *(p + 1) > '9'))) {
return NGX_ERROR;
}

- day = (*p - '0') * 10 + *(p + 1) - '0';
- p += 2;
+ if (*(p + 1) == ' ') {
+ day = (*p - '0');
+ p += 1;
+ } else {
+ day = (*p - '0') * 10 + *(p + 1) - '0';
+ p += 2;
+ }

if (*p == ' ') {
if (end - p < 18) {

Regards,
Wandenberg
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] making ngx_http_parse_time support 1 digit day Attachments

wandenberg 1611 November 09, 2012 09:38AM

Re: [PATCH] making ngx_http_parse_time support 1 digit day

Maxim Dounin 640 November 09, 2012 10:54AM

Re: [PATCH] making ngx_http_parse_time support 1 digit day

wandenberg 771 November 09, 2012 11:34AM

Re: [PATCH] making ngx_http_parse_time support 1 digit day

Maxim Dounin 640 November 09, 2012 12:40PM

Re: [PATCH] making ngx_http_parse_time support 1 digit day

wandenberg 960 November 09, 2012 12:48PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 277
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready