Welcome! Log In Create A New Profile

Advanced

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

Anonymous User
July 07, 2012 05:18PM
Author: mdounin
Date: 2012-07-07 21:16:51 +0000 (Sat, 07 Jul 2012)
New Revision: 4743
URL: http://trac.nginx.org/nginx/changeset/4743/nginx

Log:
Added Last-Modified parsing in add_header.

This allows to use last modified time set in If-Range checks. Code
simplified to improve readability.


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:16:21 UTC (rev 4742)
+++ trunk/src/http/modules/ngx_http_headers_filter_module.c 2012-07-07 21:16:51 UTC (rev 4743)
@@ -72,9 +72,7 @@

{ ngx_string("Cache-Control"), 0, ngx_http_add_cache_control },

- { ngx_string("Last-Modified"),
- offsetof(ngx_http_headers_out_t, last_modified),
- ngx_http_set_last_modified },
+ { ngx_string("Last-Modified"), 0, ngx_http_set_last_modified },

{ ngx_null_string, 0, NULL }
};
@@ -368,34 +366,24 @@
ngx_http_set_last_modified(ngx_http_request_t *r, ngx_http_header_val_t *hv,
ngx_str_t *value)
{
- ngx_table_elt_t *h, **old;
+ ngx_table_elt_t *h;

- old = (ngx_table_elt_t **) ((char *) &r->headers_out + hv->offset);
+ ngx_http_clear_last_modified(r);

- r->headers_out.last_modified_time = -1;
+ if (value->len == 0) {
+ return NGX_OK;
+ }

- if (*old == NULL) {
+ r->headers_out.last_modified_time = ngx_http_parse_time(value->data,
+ value->len);

- if (value->len == 0) {
- return NGX_OK;
- }
+ h = ngx_list_push(&r->headers_out.headers);
+ if (h == NULL) {
+ return NGX_ERROR;
+ }

- h = ngx_list_push(&r->headers_out.headers);
- if (h == NULL) {
- return NGX_ERROR;
- }
+ r->headers_out.last_modified = h;

- *old = h;
-
- } else {
- h = *old;
-
- if (value->len == 0) {
- h->hash = 0;
- return NGX_OK;
- }
- }
-
h->hash = 1;
h->key = hv->key;
h->value = *value;

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

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

Anonymous User 856 July 07, 2012 05:18PM



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

Online Users

Guests: 177
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