mod_cgi: make read buffer as big as incoming data block

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2778 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.29
Stefan Bühler 12 years ago
parent 1eef447d32
commit 33e30b486a

@ -6,6 +6,7 @@ NEWS
- 1.4.29 -
* Fix mod_proxy waiting for response even if content-length is 0 (fixes #2259)
* Silence annoying "connection closed: poll() -> ERR" error.log message (fixes #2257)
* mod_cgi: make read buffer as big as incoming data block
- 1.4.28 - 2010-08-22
* Rename fdevent_event_add to _set to reflect what the function does. Fix some handlers. (fixes #2249)

@ -341,8 +341,19 @@ static int cgi_demux_response(server *srv, handler_ctx *hctx) {
while(1) {
int n;
int toread;
#if defined(__WIN32)
buffer_prepare_copy(hctx->response, 4 * 1024);
#else
if (ioctl(con->fd, FIONREAD, &toread) || toread == 0 || toread <= 4*1024) {
buffer_prepare_copy(hctx->response, 4 * 1024);
} else {
if (toread > MAX_READ_LIMIT) toread = MAX_READ_LIMIT;
buffer_prepare_copy(hctx->response, toread + 1);
}
#endif
buffer_prepare_copy(hctx->response, 1024);
if (-1 == (n = read(hctx->fd, hctx->response->ptr, hctx->response->size - 1))) {
if (errno == EAGAIN || errno == EINTR) {
/* would block, wait for signal */

Loading…
Cancel
Save