aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_parse_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/ngx_http_parse_time.c')
-rw-r--r--src/http/ngx_http_parse_time.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/http/ngx_http_parse_time.c b/src/http/ngx_http_parse_time.c
new file mode 100644
index 000000000..3e730a61a
--- /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:
+
+
+ }
+ }
+}