comparison src/http/ngx_http_parse_time.c @ 28:7ca9bdc82b3f NGINX_0_1_14

nginx 0.1.14 *) Feature: the autoconfiguration directives: --http-client-body-temp-path=PATH, --http-proxy-temp-path=PATH, and --http-fastcgi-temp-path=PATH *) Change: the directory name for the temporary files with the client request body is specified by directive client_body_temp_path, by default it is <prefix>/client_body_temp. *) Feature: the ngx_http_fastcgi_module and the directives: fastcgi_pass, fastcgi_root, fastcgi_index, fastcgi_params, fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout, fastcgi_send_lowat, fastcgi_header_buffer_size, fastcgi_buffers, fastcgi_busy_buffers_size, fastcgi_temp_path, fastcgi_max_temp_file_size, fastcgi_temp_file_write_size, fastcgi_next_upstream, and fastcgi_x_powered_by. *) Bugfix: the "[alert] zero size buf" error; bug appeared in 0.1.3. *) Change: the URI must be specified after the host name in the proxy_pass directive. *) Change: the %3F symbol in the URI was considered as the argument string start. *) Feature: the unix domain sockets support in the ngx_http_proxy_module. *) Feature: the ssl_engine and ssl_ciphers directives. Thanks to Sergey Skvortsov for SSL-accelerator.
author Igor Sysoev <http://sysoev.ru>
date Tue, 18 Jan 2005 00:00:00 +0300
parents f0b350454894
children 72eb30262aac
comparison
equal deleted inserted replaced
27:66901c2556fd 28:7ca9bdc82b3f
214 214
215 year = (*p - '0') * 1000 + (*(p + 1) - '0') * 100 215 year = (*p - '0') * 1000 + (*(p + 1) - '0') * 100
216 + (*(p + 2) - '0') * 10 + *(p + 3) - '0'; 216 + (*(p + 2) - '0') * 10 + *(p + 3) - '0';
217 } 217 }
218 218
219 #if 0
220 printf("%d.%d.%d %d:%d:%d\n", day, month + 1, year, hour, min, sec);
221 #endif
222
223 if (hour > 23 || min > 59 || sec > 59) { 219 if (hour > 23 || min > 59 || sec > 59) {
224 return NGX_ERROR; 220 return NGX_ERROR;
225 } 221 }
226 222
227 if (day == 29 && month == 1) { 223 if (day == 29 && month == 1) {
237 return NGX_ERROR; 233 return NGX_ERROR;
238 } 234 }
239 235
240 /* 236 /*
241 * shift new year to March 1 and start months from 1 (not 0), 237 * shift new year to March 1 and start months from 1 (not 0),
242 * it's needed for Gauss's formula 238 * it is needed for Gauss's formula
243 */ 239 */
244 240
245 if (--month <= 0) { 241 if (--month <= 0) {
246 month += 12; 242 month += 12;
247 year -= 1; 243 year -= 1;
248 } 244 }
249 245
250 /* Gauss's formula for Grigorian days from 1 March 1 BC */ 246 /* Gauss's formula for Grigorian days from 1 March 1 BC */
251 247
252 return (365 * year + year / 4 - year / 100 + year / 400 248 return (365 * year + year / 4 - year / 100 + year / 400
253 + 367 * month / 12 - 31 249 + 367 * month / 12 - 31
254 + day 250 + day
255 251
256 /* 252 /*
257 * 719527 days were between March 1, 1 BC and March 1, 1970, 253 * 719527 days were between March 1, 1 BC and March 1, 1970,
258 * 31 and 28 days in January and February 1970 254 * 31 and 28 days in January and February 1970
259 */ 255 */
260 256
261 - 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec; 257 - 719527 + 31 + 28) * 86400 + hour * 3600 + min * 60 + sec;
262 } 258 }
263
264 #if 0
265 char zero[] = "Sun, 01 Jan 1970 08:49:30";
266 char one[] = "Sunday, 11-Dec-02 08:49:30";
267 char two[] = "Sun Mar 1 08:49:37 2000";
268 char thr[] = "Sun Dec 11 08:49:37 2002";
269
270 main()
271 {
272 int rc;
273
274 rc = ngx_http_parse_time(zero, sizeof(zero) - 1);
275 printf("rc: %d\n", rc);
276
277 rc = ngx_http_parse_time(one, sizeof(one) - 1);
278 printf("rc: %d\n", rc);
279
280 rc = ngx_http_parse_time(two, sizeof(two) - 1);
281 printf("rc: %d\n", rc);
282
283 rc = ngx_http_parse_time(thr, sizeof(thr) - 1);
284 printf("rc: %d\n", rc);
285 }
286
287 #endif