Improve FastCGI performance (fixes #1999)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2509 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.23
Stefan Bühler 14 years ago
parent b202898c40
commit b063f0186a

@ -44,6 +44,7 @@ NEWS
* Fix mod-fastcgi counters
* Modify fastcgi error message
* Backup errno for later usage (reported by Guido Reina via mailinglist)
* Improve FastCGI performance (fixes #1999)
- 1.4.22 - 2009-03-07
* Fix wrong lua type for CACHE_MISS/CACHE_HIT in mod_cml (fixes #533)

@ -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;

Loading…
Cancel
Save