comparison src/core/ngx_times.c @ 4:4b2dafa26fe2 NGINX_0_1_2

nginx 0.1.2 *) Feature: the --user=USER, --group=GROUP, and --with-ld-opt=OPTIONS options in configure. *) Feature: the server_name directive supports *.domain.tld. *) Bugfix: the portability improvements. *) Bugfix: if configuration file was set in command line, the reconfiguration was impossible; bug appeared in 0.1.1. *) Bugfix: proxy module may get caught in an endless loop when sendfile is not used. *) Bugfix: with sendfile the response was not recoded according to the charset module directives; bug appeared in 0.1.1. *) Bugfix: very seldom bug in the kqueue processing. *) Bugfix: the gzip module compressed the proxied responses that was already compressed.
author Igor Sysoev <http://sysoev.ru>
date Thu, 21 Oct 2004 00:00:00 +0400
parents f0b350454894
children 46833bd150cb
comparison
equal deleted inserted replaced
3:8beaf7b3241f 4:4b2dafa26fe2
210 #endif 210 #endif
211 211
212 } 212 }
213 213
214 214
215 u_char *ngx_http_time(u_char *buf, time_t t)
216 #if 0
215 size_t ngx_http_time(u_char *buf, time_t t) 217 size_t ngx_http_time(u_char *buf, time_t t)
218 #endif
216 { 219 {
217 ngx_tm_t tm; 220 ngx_tm_t tm;
218 221
219 ngx_gmtime(t, &tm); 222 ngx_gmtime(t, &tm);
220 223
224 return ngx_sprintf(buf, "%s, %02d %s %4d %02d:%02d:%02d GMT",
225 week[tm.ngx_tm_wday],
226 tm.ngx_tm_mday,
227 months[tm.ngx_tm_mon - 1],
228 tm.ngx_tm_year,
229 tm.ngx_tm_hour,
230 tm.ngx_tm_min,
231 tm.ngx_tm_sec);
232
233 #if 0
221 return ngx_snprintf((char *) buf, sizeof("Mon, 28 Sep 1970 06:00:00 GMT"), 234 return ngx_snprintf((char *) buf, sizeof("Mon, 28 Sep 1970 06:00:00 GMT"),
222 "%s, %02d %s %4d %02d:%02d:%02d GMT", 235 "%s, %02d %s %4d %02d:%02d:%02d GMT",
223 week[tm.ngx_tm_wday], 236 week[tm.ngx_tm_wday],
224 tm.ngx_tm_mday, 237 tm.ngx_tm_mday,
225 months[tm.ngx_tm_mon - 1], 238 months[tm.ngx_tm_mon - 1],
226 tm.ngx_tm_year, 239 tm.ngx_tm_year,
227 tm.ngx_tm_hour, 240 tm.ngx_tm_hour,
228 tm.ngx_tm_min, 241 tm.ngx_tm_min,
229 tm.ngx_tm_sec); 242 tm.ngx_tm_sec);
230 } 243 #endif
231 244 }
232 245
246
247 u_char *ngx_http_cookie_time(u_char *buf, time_t t)
248 #if 0
233 size_t ngx_http_cookie_time(u_char *buf, time_t t) 249 size_t ngx_http_cookie_time(u_char *buf, time_t t)
250 #endif
234 { 251 {
235 ngx_tm_t tm; 252 ngx_tm_t tm;
236 253
237 ngx_gmtime(t, &tm); 254 ngx_gmtime(t, &tm);
238 255
239 /* 256 /*
240 * Netscape 3.x does not understand 4-digit years at all and 257 * Netscape 3.x does not understand 4-digit years at all and
241 * 2-digit years more than "37" 258 * 2-digit years more than "37"
242 */ 259 */
243 260
261 return ngx_sprintf(buf,
262 (tm.ngx_tm_year > 2037) ?
263 "%s, %02d-%s-%d %02d:%02d:%02d GMT":
264 "%s, %02d-%s-%02d %02d:%02d:%02d GMT",
265 week[tm.ngx_tm_wday],
266 tm.ngx_tm_mday,
267 months[tm.ngx_tm_mon - 1],
268 (tm.ngx_tm_year > 2037) ? tm.ngx_tm_year:
269 tm.ngx_tm_year % 100,
270 tm.ngx_tm_hour,
271 tm.ngx_tm_min,
272 tm.ngx_tm_sec);
273
274 #if 0
244 if (tm.ngx_tm_year > 2037) { 275 if (tm.ngx_tm_year > 2037) {
245 return ngx_snprintf((char *) buf, 276 return ngx_snprintf((char *) buf,
246 sizeof("Mon, 28-Sep-1970 06:00:00 GMT"), 277 sizeof("Mon, 28-Sep-1970 06:00:00 GMT"),
247 "%s, %02d-%s-%d %02d:%02d:%02d GMT", 278 "%s, %02d-%s-%d %02d:%02d:%02d GMT",
248 week[tm.ngx_tm_wday], 279 week[tm.ngx_tm_wday],
262 tm.ngx_tm_year % 100, 293 tm.ngx_tm_year % 100,
263 tm.ngx_tm_hour, 294 tm.ngx_tm_hour,
264 tm.ngx_tm_min, 295 tm.ngx_tm_min,
265 tm.ngx_tm_sec); 296 tm.ngx_tm_sec);
266 } 297 }
298 #endif
267 } 299 }
268 300
269 301
270 void ngx_gmtime(time_t t, ngx_tm_t *tp) 302 void ngx_gmtime(time_t t, ngx_tm_t *tp)
271 { 303 {