summaryrefslogtreecommitdiff
path: root/src/mod_fastcgi.c
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2009-06-07 17:46:11 +0000
committerStefan Bühler <stbuehler@web.de>2009-06-07 17:46:11 +0000
commitb063f0186a526faebb7e1743382ce097ac168a87 (patch)
treec1d2be5ea84de302bf5fc6b316d000d206e6a505 /src/mod_fastcgi.c
parentb202898c40943f8bddbf6fd077f3de2a5167cd6c (diff)
downloadlighttpd-git-b063f0186a526faebb7e1743382ce097ac168a87.tar.gz
Improve FastCGI performance (fixes #1999)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2509 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/mod_fastcgi.c')
-rw-r--r--src/mod_fastcgi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c
index 7b7e742d..0fbfebf5 100644
--- a/src/mod_fastcgi.c
+++ b/src/mod_fastcgi.c
@@ -2343,10 +2343,15 @@ static int fastcgi_get_packet(server *srv, handler_ctx *hctx, fastcgi_response_p
/* get at least the FastCGI header */
for (c = hctx->rb->first; c; c = c->next) {
+ size_t weWant = sizeof(*header) - (packet->b->used - 1);
+ size_t weHave = c->mem->used - c->offset - 1;
+
+ if (weHave > weWant) weHave = weWant;
+
if (packet->b->used == 0) {
- buffer_copy_string_len(packet->b, c->mem->ptr + c->offset, c->mem->used - c->offset - 1);
+ buffer_copy_string_len(packet->b, c->mem->ptr + c->offset, weHave);
} else {
- buffer_append_string_len(packet->b, c->mem->ptr + c->offset, c->mem->used - c->offset - 1);
+ buffer_append_string_len(packet->b, c->mem->ptr + c->offset, weHave);
}
if (packet->b->used >= sizeof(*header) + 1) break;