comparison src/http/ngx_http_file_cache.c @ 5737:44b9ab7752e3

Cache: ETag now saved into cache header.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 26 Jun 2014 02:28:23 +0400
parents 2fe1967f8854
children 063f7e75f9ef
comparison
equal deleted inserted replaced
5736:2fe1967f8854 5737:44b9ab7752e3
523 c->last_modified = h->last_modified; 523 c->last_modified = h->last_modified;
524 c->date = h->date; 524 c->date = h->date;
525 c->valid_msec = h->valid_msec; 525 c->valid_msec = h->valid_msec;
526 c->header_start = h->header_start; 526 c->header_start = h->header_start;
527 c->body_start = h->body_start; 527 c->body_start = h->body_start;
528 c->etag.len = h->etag_len;
529 c->etag.data = h->etag;
528 530
529 r->cached = 1; 531 r->cached = 1;
530 532
531 cache = c->file_cache; 533 cache = c->file_cache;
532 534
887 h->date = c->date; 889 h->date = c->date;
888 h->crc32 = c->crc32; 890 h->crc32 = c->crc32;
889 h->valid_msec = (u_short) c->valid_msec; 891 h->valid_msec = (u_short) c->valid_msec;
890 h->header_start = (u_short) c->header_start; 892 h->header_start = (u_short) c->header_start;
891 h->body_start = (u_short) c->body_start; 893 h->body_start = (u_short) c->body_start;
894
895 if (c->etag.len <= NGX_HTTP_CACHE_ETAG_LEN) {
896 h->etag_len = (u_char) c->etag.len;
897 ngx_memcpy(h->etag, c->etag.data, c->etag.len);
898 }
892 899
893 p = buf + sizeof(ngx_http_file_cache_header_t); 900 p = buf + sizeof(ngx_http_file_cache_header_t);
894 901
895 p = ngx_cpymem(p, ngx_http_file_cache_key, sizeof(ngx_http_file_cache_key)); 902 p = ngx_cpymem(p, ngx_http_file_cache_key, sizeof(ngx_http_file_cache_key));
896 903
1075 h.crc32 = c->crc32; 1082 h.crc32 = c->crc32;
1076 h.valid_msec = (u_short) c->valid_msec; 1083 h.valid_msec = (u_short) c->valid_msec;
1077 h.header_start = (u_short) c->header_start; 1084 h.header_start = (u_short) c->header_start;
1078 h.body_start = (u_short) c->body_start; 1085 h.body_start = (u_short) c->body_start;
1079 1086
1087 if (c->etag.len <= NGX_HTTP_CACHE_ETAG_LEN) {
1088 h.etag_len = (u_char) c->etag.len;
1089 ngx_memcpy(h.etag, c->etag.data, c->etag.len);
1090 }
1091
1080 (void) ngx_write_file(&file, (u_char *) &h, 1092 (void) ngx_write_file(&file, (u_char *) &h,
1081 sizeof(ngx_http_file_cache_header_t), 0); 1093 sizeof(ngx_http_file_cache_header_t), 0);
1082 1094
1083 done: 1095 done:
1084 1096