Mercurial > hg > nginx-vendor-0-7
annotate src/core/ngx_parse.c @ 506:b9fdcaf2062b NGINX_0_7_65
nginx 0.7.65
*) Security: now nginx/Windows ignores trailing spaces in URI.
Thanks to Dan Crowley, Core Security Technologies.
*) Security: now nginx/Windows ignores short files names.
Thanks to Dan Crowley, Core Security Technologies.
*) Change: now the "009" status code is written to an access log for
proxied HTTP/0.9 responses.
*) Change: now the default buffer size of the
"large_client_header_buffers" directive is 8K.
Thanks to Andrew Cholakian.
*) Change: now default SSL ciphers are "HIGH:!ADH:!MD5".
*) Change: now SSLv2 protocol is disabled by default.
*) Change: now $host variable value is always low case.
*) Feature: the conf/fastcgi.conf for simple FastCGI configurations.
*) Feature: now URI part is not required a "proxy_pass" directive if
variables are used.
*) Feature: the $ssl_session_id variable.
*) Bugfix: if a proxied or FastCGI request was internally redirected to
another proxied or FastCGI location, then $upstream_response_time
variable may have abnormally large value; the bug had appeared in
0.7.63.
*) Bugfix: if the "expires modified" set date in the past, then a
negative number was set in the "Cache-Control" response header
line.
Thanks to Alex Kapranoff.
*) Bugfix: nginx closed a connection if a cached response had an empty
body.
Thanks to Piotr Sikora.
*) Bugfix: nginx cached a 304 response if there was the "If-None-Match"
header line in a proxied request.
Thanks to Tim Dettrick and David Kostal.
*) Bugfix: nginx did not treat a comma as separator in the
"Cache-Control" backend response header line.
*) Bugfix: cached HTTP/0.9 responses were handled incorrectly.
*) Bugfix: nginx sent gzipped responses to clients those do not support
gzip, if "gzip_static on" and "gzip_vary off"; the bug had appeared
in 0.8.16.
*) Bugfix: nginx always added "Content-Encoding: gzip" response header
line in 304 responses sent by ngx_http_gzip_static_module.
*) Bugfix: the "!-x" operator did not work.
Thanks to Maxim Dounin.
*) Bugfix: a segmentation fault might occur in a worker process, if
limit_rate was used in HTTPS server.
Thanks to Maxim Dounin.
*) Bugfix: a segmentation fault might occur in a worker process while
$limit_rate logging.
Thanks to Maxim Dounin.
*) Bugfix: nginx did not support dates in 2038 year on 32-bit platforms;
*) Bugfix: nginx/Windows tried to delete a temporary file twice if the
file should replace an already existent file.
*) Bugfix: nginx/Windows tried to rename a temporary file twice if the
file should replace an already existent file.
*) Bugfix: nginx/Windows might not create temporary file, a cache file,
or "proxy/fastcgi_store"d file if a worker had no enough access
rights for top level directories.
*) Bugfix: in UTF-8 encoding support by "try_files" directive in
nginx/Windows.
*) Bugfix: UTF-8 encoding usage in the ngx_http_autoindex_module.
Thanks to Maxim Dounin.
*) Bugfix: the ngx_http_autoindex_module did not show the trailing
slash in links to a directory; the bug had appeared in 0.7.15.
*) Bugfix: nginx did not close a log file set by the --error-log-path
configuration option; the bug had appeared in 0.7.53.
*) Bugfix: "addition_types" directive was incorrectly named
"addtion_types".
*) Bugfix: invalid request line in $request variable was written in
access_log only if error_log was set to "info" or "debug" level.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 01 Feb 2010 00:00:00 +0000 |
parents | 6639b93e81b2 |
children |
rev | line source |
---|---|
0 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 | |
10 | |
112 | 11 ssize_t |
12 ngx_parse_size(ngx_str_t *line) | |
0 | 13 { |
372 | 14 u_char unit; |
0 | 15 size_t len; |
112 | 16 ssize_t size; |
17 ngx_int_t scale; | |
0 | 18 |
19 len = line->len; | |
372 | 20 unit = line->data[len - 1]; |
0 | 21 |
372 | 22 switch (unit) { |
0 | 23 case 'K': |
24 case 'k': | |
25 len--; | |
26 scale = 1024; | |
27 break; | |
28 | |
29 case 'M': | |
30 case 'm': | |
31 len--; | |
32 scale = 1024 * 1024; | |
33 break; | |
34 | |
35 default: | |
36 scale = 1; | |
37 } | |
38 | |
112 | 39 size = ngx_atosz(line->data, len); |
0 | 40 if (size == NGX_ERROR) { |
41 return NGX_ERROR; | |
42 } | |
43 | |
44 size *= scale; | |
45 | |
46 return size; | |
47 } | |
48 | |
49 | |
212 | 50 off_t |
51 ngx_parse_offset(ngx_str_t *line) | |
52 { | |
372 | 53 u_char unit; |
212 | 54 off_t offset; |
55 size_t len; | |
56 ngx_int_t scale; | |
57 | |
58 len = line->len; | |
372 | 59 unit = line->data[len - 1]; |
212 | 60 |
372 | 61 switch (unit) { |
212 | 62 case 'K': |
63 case 'k': | |
64 len--; | |
65 scale = 1024; | |
66 break; | |
67 | |
68 case 'M': | |
69 case 'm': | |
70 len--; | |
71 scale = 1024 * 1024; | |
72 break; | |
73 | |
74 case 'G': | |
75 case 'g': | |
76 len--; | |
77 scale = 1024 * 1024 * 1024; | |
78 break; | |
79 | |
80 default: | |
81 scale = 1; | |
82 } | |
83 | |
84 offset = ngx_atoof(line->data, len); | |
85 if (offset == NGX_ERROR) { | |
86 return NGX_ERROR; | |
87 } | |
88 | |
89 offset *= scale; | |
90 | |
91 return offset; | |
92 } | |
93 | |
94 | |
112 | 95 ngx_int_t |
372 | 96 ngx_parse_time(ngx_str_t *line, ngx_uint_t sec) |
0 | 97 { |
372 | 98 u_char *p, *last; |
200 | 99 ngx_int_t value, total, scale; |
372 | 100 ngx_uint_t max, valid; |
0 | 101 enum { |
102 st_start = 0, | |
103 st_year, | |
104 st_month, | |
105 st_week, | |
106 st_day, | |
107 st_hour, | |
108 st_min, | |
109 st_sec, | |
110 st_msec, | |
111 st_last | |
112 } step; | |
113 | |
372 | 114 valid = 0; |
115 value = 0; | |
0 | 116 total = 0; |
117 step = sec ? st_start : st_month; | |
372 | 118 scale = sec ? 1 : 1000; |
0 | 119 |
372 | 120 p = line->data; |
121 last = p + line->len; | |
0 | 122 |
372 | 123 while (p < last) { |
0 | 124 |
372 | 125 if (*p >= '0' && *p <= '9') { |
126 value = value * 10 + (*p++ - '0'); | |
127 valid = 1; | |
128 continue; | |
0 | 129 } |
130 | |
372 | 131 switch (*p++) { |
0 | 132 |
133 case 'y': | |
134 if (step > st_start) { | |
135 return NGX_ERROR; | |
136 } | |
137 step = st_year; | |
138 max = 68; | |
139 scale = 60 * 60 * 24 * 365; | |
140 break; | |
141 | |
142 case 'M': | |
143 if (step > st_year) { | |
144 return NGX_ERROR; | |
145 } | |
146 step = st_month; | |
147 max = 828; | |
148 scale = 60 * 60 * 24 * 30; | |
149 break; | |
150 | |
151 case 'w': | |
152 if (step > st_month) { | |
153 return NGX_ERROR; | |
154 } | |
155 step = st_week; | |
156 max = 3550; | |
157 scale = 60 * 60 * 24 * 7; | |
158 break; | |
159 | |
160 case 'd': | |
161 if (step > st_week) { | |
162 return NGX_ERROR; | |
163 } | |
164 step = st_day; | |
165 max = 24855; | |
166 scale = 60 * 60 * 24; | |
167 break; | |
168 | |
169 case 'h': | |
170 if (step > st_day) { | |
171 return NGX_ERROR; | |
172 } | |
173 step = st_hour; | |
174 max = 596523; | |
175 scale = 60 * 60; | |
176 break; | |
177 | |
178 case 'm': | |
372 | 179 if (*p == 's') { |
180 if (sec || step > st_sec) { | |
181 return NGX_ERROR; | |
182 } | |
183 p++; | |
184 step = st_msec; | |
185 max = 2147483647; | |
186 scale = 1; | |
187 break; | |
188 } | |
189 | |
0 | 190 if (step > st_hour) { |
191 return NGX_ERROR; | |
192 } | |
193 step = st_min; | |
194 max = 35791394; | |
195 scale = 60; | |
196 break; | |
197 | |
198 case 's': | |
199 if (step > st_min) { | |
200 return NGX_ERROR; | |
201 } | |
202 step = st_sec; | |
203 max = 2147483647; | |
204 scale = 1; | |
205 break; | |
206 | |
372 | 207 case ' ': |
208 if (step > st_min) { | |
209 return NGX_ERROR; | |
210 } | |
0 | 211 step = st_last; |
212 max = 2147483647; | |
213 scale = 1; | |
372 | 214 break; |
0 | 215 |
372 | 216 default: |
0 | 217 return NGX_ERROR; |
218 } | |
219 | |
220 if (step != st_msec && !sec) { | |
221 scale *= 1000; | |
222 max /= 1000; | |
223 } | |
224 | |
372 | 225 if ((ngx_uint_t) value > max) { |
226 return NGX_ERROR; | |
0 | 227 } |
228 | |
229 total += value * scale; | |
230 | |
372 | 231 if ((ngx_uint_t) total > 2147483647) { |
232 return NGX_ERROR; | |
0 | 233 } |
234 | |
372 | 235 value = 0; |
236 scale = sec ? 1 : 1000; | |
237 | |
238 while (p < last && *p == ' ') { | |
239 p++; | |
0 | 240 } |
241 } | |
242 | |
372 | 243 if (valid) { |
244 return total + value * scale; | |
245 } | |
246 | |
247 return NGX_ERROR; | |
0 | 248 } |