openbsd-ports/www/lighttpd/patches/patch-src_mod_cgi_c
sthen bd91594371 Fixes from upstream via Brad (maintainer)
* mod_proxy: fix delayed connect
* mod_cgi: make read buffer as big as incoming data block
* ssl: Support for Diffie-Hellman and Elliptic-Curve Diffie-Hellman
key exchange (add ssl.use-sslv3)

While there, update autoconf version comment, should be 2.67.
2011-03-20 13:42:53 +00:00

25 lines
839 B
Plaintext

$OpenBSD: patch-src_mod_cgi_c,v 1.3 2011/03/20 13:42:53 sthen Exp $
--- src/mod_cgi.c.orig Mon Mar 14 21:11:20 2011
+++ src/mod_cgi.c Mon Mar 14 21:13:22 2011
@@ -341,8 +341,19 @@ static int cgi_demux_response(server *srv, handler_ctx
while(1) {
int n;
+ int toread;
- buffer_prepare_copy(hctx->response, 1024);
+#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
+
if (-1 == (n = read(hctx->fd, hctx->response->ptr, hctx->response->size - 1))) {
if (errno == EAGAIN || errno == EINTR) {
/* would block, wait for signal */