Mercurial > hg > nginx-quic
annotate src/http/ngx_http_parse_time.c @ 5862:ecbb99aa0e12
Limit req: use complex value in limit_req_zone.
One intentional side effect of this change is that key is allowed only
in the first position. Previously, it was possible to specify the key
variable at any position, but that was never documented, and is contrary
with nginx configuration practice for positional parameters.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Wed, 24 Sep 2014 21:55:19 +0400 |
parents | 4c36e15651f7 |
children |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
290
diff
changeset
|
6 |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
25
diff
changeset
|
8 #include <ngx_config.h> |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
25
diff
changeset
|
9 #include <ngx_core.h> |
4759
4c36e15651f7
Fixed compilation with -Wmissing-prototypes.
Ruslan Ermilov <ru@nginx.com>
parents:
4499
diff
changeset
|
10 #include <ngx_http.h> |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
12 |
3207
154b5f8565a9
use ngx_uint_t instead of int,
Igor Sysoev <igor@sysoev.ru>
parents:
2233
diff
changeset
|
13 static ngx_uint_t mday[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 |
1628 | 15 time_t |
16 ngx_http_parse_time(u_char *value, size_t len) | |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
17 { |
3207
154b5f8565a9
use ngx_uint_t instead of int,
Igor Sysoev <igor@sysoev.ru>
parents:
2233
diff
changeset
|
18 u_char *p, *end; |
154b5f8565a9
use ngx_uint_t instead of int,
Igor Sysoev <igor@sysoev.ru>
parents:
2233
diff
changeset
|
19 ngx_int_t month; |
154b5f8565a9
use ngx_uint_t instead of int,
Igor Sysoev <igor@sysoev.ru>
parents:
2233
diff
changeset
|
20 ngx_uint_t day, year, hour, min, sec; |
3208
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
21 uint64_t time; |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
22 enum { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
23 no = 0, |
684 | 24 rfc822, /* Tue, 10 Nov 2002 23:50:13 */ |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
25 rfc850, /* Tuesday, 10-Dec-02 23:50:13 */ |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
26 isoc /* Tue Dec 10 23:50:13 2002 */ |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
27 } fmt; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
28 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
25
diff
changeset
|
29 fmt = 0; |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
30 end = value + len; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
31 |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
32 #if (NGX_SUPPRESS_WARN) |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
33 day = 32; |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
34 year = 2038; |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
35 #endif |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
44
diff
changeset
|
36 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
37 for (p = value; p < end; p++) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
38 if (*p == ',') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
39 break; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
40 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
41 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
42 if (*p == ' ') { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
43 fmt = isoc; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
44 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
45 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
46 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
47 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
48 for (p++; p < end; p++) |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
49 if (*p != ' ') { |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
50 break; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
51 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
52 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
53 if (end - p < 18) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
54 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
55 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
56 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
57 if (fmt != isoc) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
58 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
59 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
60 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
61 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
62 day = (*p - '0') * 10 + *(p + 1) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
63 p += 2; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
64 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
65 if (*p == ' ') { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
66 if (end - p < 18) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
67 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
68 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
69 fmt = rfc822; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
70 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
71 } else if (*p == '-') { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
72 fmt = rfc850; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
73 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
74 } else { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
75 return NGX_ERROR; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
76 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
77 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
78 p++; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
79 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
80 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
81 switch (*p) { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
82 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
83 case 'J': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
84 month = *(p + 1) == 'a' ? 0 : *(p + 2) == 'n' ? 5 : 6; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
85 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
86 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
87 case 'F': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
88 month = 1; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
89 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
90 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
91 case 'M': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
92 month = *(p + 2) == 'r' ? 2 : 4; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
93 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
94 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
95 case 'A': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
96 month = *(p + 1) == 'p' ? 3 : 7; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
97 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
98 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
99 case 'S': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
100 month = 8; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
101 break; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
102 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
103 case 'O': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
104 month = 9; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
105 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
106 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
107 case 'N': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
108 month = 10; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
109 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
110 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
111 case 'D': |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
112 month = 11; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
113 break; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
114 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
115 default: |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
116 return NGX_ERROR; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
117 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
118 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
119 p += 3; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
120 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
121 if ((fmt == rfc822 && *p != ' ') || (fmt == rfc850 && *p != '-')) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
122 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
123 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
124 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
125 p++; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
126 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
127 if (fmt == rfc822) { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
128 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9' |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
129 || *(p + 2) < '0' || *(p + 2) > '9' |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
130 || *(p + 3) < '0' || *(p + 3) > '9') |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
131 { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
132 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
133 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
134 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
135 year = (*p - '0') * 1000 + (*(p + 1) - '0') * 100 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
136 + (*(p + 2) - '0') * 10 + *(p + 3) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
137 p += 4; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
138 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
139 } else if (fmt == rfc850) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
140 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
141 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
142 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
143 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
144 year = (*p - '0') * 10 + *(p + 1) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
145 year += (year < 70) ? 2000 : 1900; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
146 p += 2; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
147 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
148 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
149 if (fmt == isoc) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
150 if (*p == ' ') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
151 p++; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
152 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
153 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
154 if (*p < '0' || *p > '9') { |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
155 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
156 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
157 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
158 day = *p++ - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
159 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
160 if (*p != ' ') { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
161 if (*p < '0' || *p > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
162 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
163 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
164 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
165 day = day * 10 + *p++ - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
166 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
167 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
168 if (end - p < 14) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
169 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
170 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
171 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
172 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
173 if (*p++ != ' ') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
174 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
175 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
176 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
177 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
178 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
179 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
180 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
181 hour = (*p - '0') * 10 + *(p + 1) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
182 p += 2; |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
183 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
184 if (*p++ != ':') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
185 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
186 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
187 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
188 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
189 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
190 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
191 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
192 min = (*p - '0') * 10 + *(p + 1) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
193 p += 2; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
194 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
195 if (*p++ != ':') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
196 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
197 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
198 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
199 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
200 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
201 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
202 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
203 sec = (*p - '0') * 10 + *(p + 1) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
204 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
205 if (fmt == isoc) { |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
206 p += 2; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
207 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
208 if (*p++ != ' ') { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
209 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
210 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
211 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
212 if (*p < '0' || *p > '9' || *(p + 1) < '0' || *(p + 1) > '9' |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
213 || *(p + 2) < '0' || *(p + 2) > '9' |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
214 || *(p + 3) < '0' || *(p + 3) > '9') |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
215 { |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
216 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
217 } |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
218 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
219 year = (*p - '0') * 1000 + (*(p + 1) - '0') * 100 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
220 + (*(p + 2) - '0') * 10 + *(p + 3) - '0'; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
221 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
222 |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
223 if (hour > 23 || min > 59 || sec > 59) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
224 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
225 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
226 |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
227 if (day == 29 && month == 1) { |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
228 if ((year & 3) || ((year % 100 == 0) && (year % 400) != 0)) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
229 return NGX_ERROR; |
44
0e81ac0bb3e2
nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
230 } |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
231 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
25
diff
changeset
|
232 } else if (day > mday[month]) { |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
233 return NGX_ERROR; |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
234 } |
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
235 |
181
811bdd2af794
nginx-0.0.1-2003-11-12-20:25:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
236 /* |
811bdd2af794
nginx-0.0.1-2003-11-12-20:25:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
237 * shift new year to March 1 and start months from 1 (not 0), |
1964 | 238 * it is needed for Gauss' formula |
181
811bdd2af794
nginx-0.0.1-2003-11-12-20:25:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
239 */ |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
240 |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
241 if (--month <= 0) { |
1062 | 242 month += 12; |
243 year -= 1; | |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
244 } |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
245 |
4499
778ef9c3fd2d
Fixed spelling in single-line comments.
Ruslan Ermilov <ru@nginx.com>
parents:
4412
diff
changeset
|
246 /* Gauss' formula for Gregorian days since March 1, 1 BC */ |
1964 | 247 |
3208
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
248 time = (uint64_t) ( |
1964 | 249 /* days in years including leap years since March 1, 1 BC */ |
250 | |
251 365 * year + year / 4 - year / 100 + year / 400 | |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
252 |
1964 | 253 /* days before the month */ |
254 | |
255 + 367 * month / 12 - 30 | |
256 | |
257 /* days before the day */ | |
258 | |
259 + day - 1 | |
181
811bdd2af794
nginx-0.0.1-2003-11-12-20:25:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
179
diff
changeset
|
260 |
479 | 261 /* |
262 * 719527 days were between March 1, 1 BC and March 1, 1970, | |
1062 | 263 * 31 and 28 days were in January and February 1970 |
479 | 264 */ |
179
9f3a78b06c48
nginx-0.0.1-2003-11-11-21:13:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
265 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
25
diff
changeset
|
266 - 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec; |
3208
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
267 |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
268 #if (NGX_TIME_T_SIZE <= 4) |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
269 |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
270 if (time > 0x7fffffff) { |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
271 return NGX_ERROR; |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
272 } |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
273 |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
274 #endif |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
275 |
8cec9724fe71
ngx_http_parse_time() should support full 32-bit time
Igor Sysoev <igor@sysoev.ru>
parents:
3207
diff
changeset
|
276 return (time_t) time; |
25
a8b156554dfe
nginx-0.0.1-2002-12-11-19:57:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
277 } |