Welcome! Log In Create A New Profile

Advanced

patch for Transfer-Encoding: chunked and proxy_cache - check if the file is complete

October 30, 2012 09:42AM
This patch is for 1.2.4. It adds some code that checks if the file is
complete when Transfer-Encoding: chunked is used.

--- nginx-1.2.4/src/http/modules/ngx_http_proxy_module.c 2012-04-23
13:40:01.000000000 +0300
+++ nginx-1.2.4_patched/src/http/modules/ngx_http_proxy_module.c
2012-10-30 14:55:24.106188123 +0200
@@ -1867,7 +1867,7 @@
return rc;

done:

+ r->upstream->chunked_cacheable = 1;
return NGX_DONE;

invalid:
--- nginx-1.2.4/src/http/ngx_http_upstream.c 2012-08-06
20:34:08.000000000 +0300
+++ nginx-1.2.4_patched/src/http/ngx_http_upstream.c 2012-10-30
15:36:23.126381731 +0200
@@ -2687,7 +2687,8 @@

tf = u->pipe->temp_file;

- if (u->headers_in.content_length_n == -1
+ if (((u->headers_in.content_length_n == -1 &&
!u->headers_in.chunked) ||
+ (u->headers_in.chunked && u->chunked_cacheable))
|| u->headers_in.content_length_n
== tf->offset - (off_t) r->cache->body_start)
{
@@ -3442,6 +3443,7 @@
!= NULL)
{
r->upstream->headers_in.chunked = 1;
+ r->upstream->chunked_cacheable = 0;
}

return NGX_OK;
--- nginx-1.2.4/src/http/ngx_http_upstream.h 2012-02-13
13:01:58.000000000 +0200
+++ nginx-1.2.4_patched/src/http/ngx_http_upstream.h 2012-10-30
14:56:36.642547808 +0200
@@ -314,6 +314,8 @@

unsigned store:1;
unsigned cacheable:1;
+ unsigned chunked_cacheable:1;
unsigned accel:1;
unsigned ssl:1;
#if (NGX_HTTP_CACHE)



Best regards
Anatoli Marinov

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

patch for Transfer-Encoding: chunked and proxy_cache - check if the file is complete

toli 1249 October 30, 2012 09:42AM

Re: patch for Transfer-Encoding: chunked and proxy_cache - check if the file is complete

Maxim Dounin 596 October 30, 2012 12:26PM

Re: patch for Transfer-Encoding: chunked and proxy_cache - check if the file is complete

toli 908 October 31, 2012 04:12AM



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

Online Users

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