5 messages in ru.sysoev.nginxRe: large SSI inclusions are truncated
FromSent OnAttachments
Evan MillerJun 8, 2007 1:14 am 
Igor SysoevJun 8, 2007 8:12 am 
Evan MillerJun 8, 2007 10:36 am 
Igor SysoevJun 16, 2007 2:38 am.txt
Evan MillerJun 16, 2007 9:58 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: large SSI inclusions are truncatedActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Jun 16, 2007 2:38:18 am
List:ru.sysoev.nginx
Attachments:

On Fri, Jun 08, 2007 at 10:37:14AM -0700, Evan Miller wrote:

Igor Sysoev wrote:

On Fri, Jun 08, 2007 at 08:14:36AM +0000, Evan Miller wrote:

I find that files included in an SSI are truncated when:

* the inclusion is retrieved from an upstream subrequest * the response to the subrequest is buffered to a file * the response to the subrequest is over about 100KB

I am using nginx 0.5.24. It works fine when I set "proxy_max_temp_file_size 0;".

I can post a debug log if no one can reproduce the problem.

Please, send me debug log.

Here's the debug log:

http://www.riceonfire.org/emiller/error.log

This seems to happen most often (only?) after a SIGHUP.

evanm@tim:~ nginx -V nginx version: nginx/0.5.24 built by gcc 4.1.2 (Ubuntu 4.1.2-0ubuntu4) configure arguments: --with-debug

Here's what I did:

evanm@tim:~ sudo rm /usr/local/nginx/logs/error.log evanm@tim:~ sudo pkill -HUP nginx evanm@tim:~ wget http://localhost/static/test.html

Here's the contents of test.html:

<!--# include virtual="/guide2.html" -->

The upstream is an Apache serving a static file.

The attached patch should fix the problem.

-- Igor Sysoev http://sysoev.ru/en/

Index: src/http/ngx_http_copy_filter_module.c =================================================================== --- src/http/ngx_http_copy_filter_module.c (revision 578) +++ src/http/ngx_http_copy_filter_module.c (working copy) @@ -117,6 +117,10 @@ r->buffered |= NGX_HTTP_COPY_BUFFERED; }

+ if (r != r->main) { + r->out = ctx->in; + } + #if (NGX_DEBUG) ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "copy filter: %i \"%V?%V\"", rc, &r->uri, &r->args); Index: src/http/ngx_http_upstream.c =================================================================== --- src/http/ngx_http_upstream.c (revision 578) +++ src/http/ngx_http_upstream.c (working copy) @@ -2157,8 +2157,17 @@

r->connection->log->action = "sending to client";

- if (rc == 0 && r == r->main && !r->post_action) { - rc = ngx_http_send_special(r, NGX_HTTP_LAST); + if (rc == 0) { + if (r == r->main) { + if (rc == 0 && !r->post_action) { + rc = ngx_http_send_special(r, NGX_HTTP_LAST); + } + + } else { + if (r->out) { + rc = NGX_AGAIN; + } + } }

ngx_http_finalize_request(r, rc);