diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-08-29 07:55:41 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-08-29 07:55:41 +0400 |
commit | a7c4a2a6f898a0b3add9f36e56288734414a12f7 (patch) | |
tree | bd7fa2cd0e26cd974df02b2788db000402d7d366 /src/core/ngx_times.c | |
parent | 967fd637e08b6df4f635014fb572296372c89254 (diff) |
nginx-0.0.10-2004-08-29-07:55:41 import
Diffstat (limited to 'src/core/ngx_times.c')
-rw-r--r-- | src/core/ngx_times.c | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c index df73a1dde..2c9985f20 100644 --- a/src/core/ngx_times.c +++ b/src/core/ngx_times.c @@ -214,14 +214,51 @@ size_t ngx_http_time(u_char *buf, time_t t) ngx_gmtime(t, &tm); 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], - 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); + "%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); +} + + +size_t ngx_http_cookie_time(u_char *buf, time_t t) +{ + ngx_tm_t tm; + + ngx_gmtime(t, &tm); + + /* + * Netscape 3.x does not understand 4-digit years at all and + * 2-digit years more than "37" + */ + + if (tm.ngx_tm_year > 2037) { + return ngx_snprintf((char *) buf, + sizeof("Mon, 28-Sep-1970 06:00:00 GMT"), + "%s, %02d-%s-%d %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); + } else { + return ngx_snprintf((char *) buf, + sizeof("Mon, 28-Sep-70 06:00:00 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 % 100, + tm.ngx_tm_hour, + tm.ngx_tm_min, + tm.ngx_tm_sec); + } } |