diff 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
line wrap: on
line diff
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -212,12 +212,25 @@ void ngx_time_update(time_t s)
 }
 
 
+u_char *ngx_http_time(u_char *buf, time_t t)
+#if 0
 size_t ngx_http_time(u_char *buf, time_t t)
+#endif
 {
     ngx_tm_t  tm;
 
     ngx_gmtime(t, &tm);
 
+    return ngx_sprintf(buf, "%s, %02d %s %4d %02d:%02d:%02d GMT",
+                       week[tm.ngx_tm_wday],
+                       tm.ngx_tm_mday,
+                       months[tm.ngx_tm_mon - 1],
+                       tm.ngx_tm_year,
+                       tm.ngx_tm_hour,
+                       tm.ngx_tm_min,
+                       tm.ngx_tm_sec);
+
+#if 0
     return ngx_snprintf((char *) buf, sizeof("Mon, 28 Sep 1970 06:00:00 GMT"),
                                       "%s, %02d %s %4d %02d:%02d:%02d GMT",
                                       week[tm.ngx_tm_wday],
@@ -227,10 +240,14 @@ size_t ngx_http_time(u_char *buf, time_t
                                       tm.ngx_tm_hour,
                                       tm.ngx_tm_min,
                                       tm.ngx_tm_sec);
+#endif
 }
 
 
+u_char *ngx_http_cookie_time(u_char *buf, time_t t)
+#if 0
 size_t ngx_http_cookie_time(u_char *buf, time_t t)
+#endif
 {
     ngx_tm_t  tm;
 
@@ -241,6 +258,20 @@ size_t ngx_http_cookie_time(u_char *buf,
      * 2-digit years more than "37"
      */
 
+    return ngx_sprintf(buf,
+                       (tm.ngx_tm_year > 2037) ?
+                                         "%s, %02d-%s-%d %02d:%02d:%02d GMT":
+                                         "%s, %02d-%s-%02d %02d:%02d:%02d GMT",
+                       week[tm.ngx_tm_wday],
+                       tm.ngx_tm_mday,
+                       months[tm.ngx_tm_mon - 1],
+                       (tm.ngx_tm_year > 2037) ? tm.ngx_tm_year:
+                                                 tm.ngx_tm_year % 100,
+                       tm.ngx_tm_hour,
+                       tm.ngx_tm_min,
+                       tm.ngx_tm_sec);
+
+#if 0
     if (tm.ngx_tm_year > 2037) {
         return ngx_snprintf((char *) buf,
                                       sizeof("Mon, 28-Sep-1970 06:00:00 GMT"),
@@ -264,6 +295,7 @@ size_t ngx_http_cookie_time(u_char *buf,
                                       tm.ngx_tm_min,
                                       tm.ngx_tm_sec);
     }
+#endif
 }