comparison src/http/modules/ngx_http_headers_filter_module.c @ 729:52d1379de54e

expires max
author Igor Sysoev <igor@sysoev.ru>
date Mon, 02 Oct 2006 08:53:30 +0000
parents 3bd0d8642ad6
children db7c468c447d
comparison
equal deleted inserted replaced
728:e82eed614d4a 729:52d1379de54e
24 24
25 25
26 #define NGX_HTTP_EXPIRES_UNSET -2147483647 26 #define NGX_HTTP_EXPIRES_UNSET -2147483647
27 #define NGX_HTTP_EXPIRES_OFF -2147483646 27 #define NGX_HTTP_EXPIRES_OFF -2147483646
28 #define NGX_HTTP_EXPIRES_EPOCH -2147483645 28 #define NGX_HTTP_EXPIRES_EPOCH -2147483645
29 #define NGX_HTTP_EXPIRES_MAX -2147483644
29 30
30 31
31 static void *ngx_http_headers_create_conf(ngx_conf_t *cf); 32 static void *ngx_http_headers_create_conf(ngx_conf_t *cf);
32 static char *ngx_http_headers_merge_conf(ngx_conf_t *cf, 33 static char *ngx_http_headers_merge_conf(ngx_conf_t *cf,
33 void *parent, void *child); 34 void *parent, void *child);
175 expires->value.data = (u_char *) "Thu, 01 Jan 1970 00:00:01 GMT"; 176 expires->value.data = (u_char *) "Thu, 01 Jan 1970 00:00:01 GMT";
176 177
177 cc->value.len = sizeof("no-cache") - 1; 178 cc->value.len = sizeof("no-cache") - 1;
178 cc->value.data = (u_char *) "no-cache"; 179 cc->value.data = (u_char *) "no-cache";
179 180
181 } else if (conf->expires == NGX_HTTP_EXPIRES_MAX) {
182 expires->value.data = (u_char *) "Thu, 31 Dec 2037 23:55:55 GMT";
183
184 /* 10 years */
185 cc->value.len = sizeof("max-age=315360000") - 1;
186 cc->value.data = (u_char *) "max-age=315360000";
187
180 } else { 188 } else {
181 expires->value.data = ngx_palloc(r->pool, len); 189 expires->value.data = ngx_palloc(r->pool, len);
182 if (expires->value.data == NULL) { 190 if (expires->value.data == NULL) {
183 return NGX_ERROR; 191 return NGX_ERROR;
184 } 192 }
347 if (ngx_strcmp(value[1].data, "epoch") == 0) { 355 if (ngx_strcmp(value[1].data, "epoch") == 0) {
348 hcf->expires = NGX_HTTP_EXPIRES_EPOCH; 356 hcf->expires = NGX_HTTP_EXPIRES_EPOCH;
349 return NGX_CONF_OK; 357 return NGX_CONF_OK;
350 } 358 }
351 359
360 if (ngx_strcmp(value[1].data, "max") == 0) {
361 hcf->expires = NGX_HTTP_EXPIRES_MAX;
362 return NGX_CONF_OK;
363 }
364
352 if (ngx_strcmp(value[1].data, "off") == 0) { 365 if (ngx_strcmp(value[1].data, "off") == 0) {
353 hcf->expires = NGX_HTTP_EXPIRES_OFF; 366 hcf->expires = NGX_HTTP_EXPIRES_OFF;
354 return NGX_CONF_OK; 367 return NGX_CONF_OK;
355 } 368 }
356 369