Mercurial > hg > nginx
diff src/http/ngx_http_parse_time.c @ 24:77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 10 Dec 2002 18:05:12 +0000 |
parents | |
children | a8b156554dfe |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/src/http/ngx_http_parse_time.c @@ -0,0 +1,64 @@ + +time_t ngx_http_parse_time() +{ + enum { + sw_start = 0, + } state; + + state = sw_start; + + while () { + switch (state) { + + case sw_start: + if (ch == ' ') { + ansi = 1; + state = sw_month; + + } else if (ch == ',') + state = sw_day_first_digit; + + break; + + case sw_day_first_digit: + if (ch == ' ') + break; + + if (ch >= '0' && ch <= '9') { + day = ch - '0'; + state = sw_day; + break; + + } + + return NGX_ERROR; + + case sw_day: + if (ansi && ch == ' ') { + state = sw_hour_first_digit; + break; + } + + if (ch >= '0' && ch <= '9') { + day = ch - '0'; + state = ansi ? sw_space_before_hour : sw_before_month; + break; + } + + return NGX_ERROR; + + case sw_before_month: + if (ch == ' ') { + rfc822 = 1; + } + + if (ch == '-') { + rfc850 = 1; + } + + case sw_space_before_hour: + + + } + } +}