Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4748 - trunk/src/http/modules

Anonymous User
July 07, 2012 05:26PM
Author: mdounin
Date: 2012-07-07 21:24:01 +0000 (Sat, 07 Jul 2012)
New Revision: 4748
URL: http://trac.nginx.org/nginx/changeset/4748/nginx

Log:
Entity tags: handling in add_header.

Notably this allows to clear ETag if one want to for some reason.


Modified:
trunk/src/http/modules/ngx_http_headers_filter_module.c

Modified: trunk/src/http/modules/ngx_http_headers_filter_module.c
===================================================================
--- trunk/src/http/modules/ngx_http_headers_filter_module.c 2012-07-07 21:22:27 UTC (rev 4747)
+++ trunk/src/http/modules/ngx_http_headers_filter_module.c 2012-07-07 21:24:01 UTC (rev 4748)
@@ -57,6 +57,8 @@
ngx_http_header_val_t *hv, ngx_str_t *value);
static ngx_int_t ngx_http_set_last_modified(ngx_http_request_t *r,
ngx_http_header_val_t *hv, ngx_str_t *value);
+static ngx_int_t ngx_http_set_response_header(ngx_http_request_t *r,
+ ngx_http_header_val_t *hv, ngx_str_t *value);

static void *ngx_http_headers_create_conf(ngx_conf_t *cf);
static char *ngx_http_headers_merge_conf(ngx_conf_t *cf,
@@ -74,6 +76,10 @@

{ ngx_string("Last-Modified"), 0, ngx_http_set_last_modified },

+ { ngx_string("ETag"),
+ offsetof(ngx_http_headers_out_t, etag),
+ ngx_http_set_response_header },
+
{ ngx_null_string, 0, NULL }
};

@@ -392,6 +398,38 @@
}


+static ngx_int_t
+ngx_http_set_response_header(ngx_http_request_t *r, ngx_http_header_val_t *hv,
+ ngx_str_t *value)
+{
+ ngx_table_elt_t *h, **old;
+
+ old = (ngx_table_elt_t **) ((char *) &r->headers_out + hv->offset);
+
+ if (*old) {
+ (*old)->hash = 0;
+ *old = NULL;
+ }
+
+ if (value->len == 0) {
+ return NGX_OK;
+ }
+
+ h = ngx_list_push(&r->headers_out.headers);
+ if (h == NULL) {
+ return NGX_ERROR;
+ }
+
+ *old = h;
+
+ h->hash = 1;
+ h->key = hv->key;
+ h->value = *value;
+
+ return NGX_OK;
+}
+
+
static void *
ngx_http_headers_create_conf(ngx_conf_t *cf)
{

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4748 - trunk/src/http/modules

Anonymous User 1077 July 07, 2012 05:26PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 304
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready