Mercurial > hg > nginx
comparison src/http/ngx_http_core_module.c @ 4748:192f54280a7a
Entity tags: set for static respones.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 09 Jul 2012 00:13:06 +0000 |
parents | cebbe4fda8aa |
children | 613750237b36 |
comparison
equal
deleted
inserted
replaced
4747:1e2ac45ad25d | 4748:192f54280a7a |
---|---|
1803 return; | 1803 return; |
1804 } | 1804 } |
1805 } | 1805 } |
1806 | 1806 |
1807 return; | 1807 return; |
1808 } | |
1809 | |
1810 | |
1811 ngx_int_t | |
1812 ngx_http_set_etag(ngx_http_request_t *r) | |
1813 { | |
1814 ngx_table_elt_t *etag; | |
1815 | |
1816 etag = ngx_list_push(&r->headers_out.headers); | |
1817 if (etag == NULL) { | |
1818 return NGX_ERROR; | |
1819 } | |
1820 | |
1821 etag->hash = 1; | |
1822 ngx_str_set(&etag->key, "ETag"); | |
1823 | |
1824 etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3); | |
1825 if (etag->value.data == NULL) { | |
1826 return NGX_ERROR; | |
1827 } | |
1828 | |
1829 etag->value.len = ngx_sprintf(etag->value.data, "\"%xT-%xO\"", | |
1830 r->headers_out.last_modified_time, | |
1831 r->headers_out.content_length_n) | |
1832 - etag->value.data; | |
1833 | |
1834 r->headers_out.etag = etag; | |
1835 | |
1836 return NGX_OK; | |
1808 } | 1837 } |
1809 | 1838 |
1810 | 1839 |
1811 ngx_int_t | 1840 ngx_int_t |
1812 ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status, | 1841 ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status, |