Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4385 - trunk/src/http

Anonymous User
December 26, 2011 05:52AM
Author: mdounin
Date: 2011-12-26 10:51:24 +0000 (Mon, 26 Dec 2011)
New Revision: 4385

Log:
Fixed interaction of limit_rate and sendfile_max_chunk.

It's possible that configured limit_rate will permit more bytes per
single operation than sendfile_max_chunk. To protect disk from takeover
by a single client it is necessary to apply sendfile_max_chunk as a limit
regardless of configured limit_rate.

See here for report (in Russian):
http://mailman.nginx.org/pipermail/nginx-ru/2010-March/032806.html


Modified:
trunk/src/http/ngx_http_write_filter_module.c

Modified: trunk/src/http/ngx_http_write_filter_module.c
===================================================================
--- trunk/src/http/ngx_http_write_filter_module.c 2011-12-26 10:49:57 UTC (rev 4384)
+++ trunk/src/http/ngx_http_write_filter_module.c 2011-12-26 10:51:24 UTC (rev 4385)
@@ -223,11 +223,14 @@
return NGX_AGAIN;
}

- } else if (clcf->sendfile_max_chunk) {
- limit = clcf->sendfile_max_chunk;
+ if (clcf->sendfile_max_chunk
+ && (off_t) clcf->sendfile_max_chunk < limit)
+ {
+ limit = clcf->sendfile_max_chunk;
+ }

} else {
- limit = 0;
+ limit = clcf->sendfile_max_chunk;
}

sent = c->sent;
@@ -265,14 +268,15 @@
delay = (ngx_msec_t) ((nsent - sent) * 1000 / r->limit_rate);

if (delay > 0) {
+ limit = 0;
c->write->delayed = 1;
ngx_add_timer(c->write, delay);
}
+ }

- } else if (c->write->ready
- && clcf->sendfile_max_chunk
- && (size_t) (c->sent - sent)
- >= clcf->sendfile_max_chunk - 2 * ngx_pagesize)
+ if (limit
+ && c->write->ready
+ && c->sent - sent >= limit - (off_t) (2 * ngx_pagesize))
{
c->write->delayed = 1;
ngx_add_timer(c->write, 1);

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

[nginx] svn commit: r4385 - trunk/src/http

Anonymous User 1272 December 26, 2011 05:52AM



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

Online Users

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