aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_core_module.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2012-07-09 00:13:06 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2012-07-09 00:13:06 +0000
commiteb7c38a49ae11d9084969790f0b86d75cc1f11c7 (patch)
tree592bdb9feb92670a494759682153ee6a8eec4de4 /src/http/ngx_http_core_module.c
parent8b00c87c385ce1b3d231cbafff2bb431acec0953 (diff)
downloadnginx-eb7c38a49ae11d9084969790f0b86d75cc1f11c7.tar.gz
nginx-eb7c38a49ae11d9084969790f0b86d75cc1f11c7.zip
Entity tags: set for static respones.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 6d7dc0abe..ebc9f7413 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1809,6 +1809,35 @@ ngx_http_set_exten(ngx_http_request_t *r)
ngx_int_t
+ngx_http_set_etag(ngx_http_request_t *r)
+{
+ ngx_table_elt_t *etag;
+
+ etag = ngx_list_push(&r->headers_out.headers);
+ if (etag == NULL) {
+ return NGX_ERROR;
+ }
+
+ etag->hash = 1;
+ ngx_str_set(&etag->key, "ETag");
+
+ etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
+ if (etag->value.data == NULL) {
+ return NGX_ERROR;
+ }
+
+ etag->value.len = ngx_sprintf(etag->value.data, "\"%xT-%xO\"",
+ r->headers_out.last_modified_time,
+ r->headers_out.content_length_n)
+ - etag->value.data;
+
+ r->headers_out.etag = etag;
+
+ return NGX_OK;
+}
+
+
+ngx_int_t
ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status,
ngx_str_t *ct, ngx_http_complex_value_t *cv)
{