Project

General

Profile

Bug #1850

Too waste memory in mod_proxy.c

Added by ycheng over 7 years ago. Updated over 7 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_proxy
Target version:
Start date:
2008-12-18
Due date:
% Done:

100%

Missing in 1.5.x:

Description

See:
http://redmine.lighttpd.net/repositories/entry/lighttpd/branches/lighttpd-1.4.x/src/mod_proxy.c
Function:
static int proxy_demux_response(server *srv, handler_ctx *hctx)
Line:
lien 655: buffer_prepare_append(hctx->response, hctx->response->used + b);

Too waste memory.
int buffer_prepare_append(buffer *b, size_t size) expands the content of the buffer, not set. The argument size is a "incremental" quantity, not the "absolute" quantity. See the srouce.
So line 655 should be changed to:
buffer_prepare_append(hctx->response, b);
I have had a test, and it works OK.

Associated revisions

Revision 2365 (diff)
Added by stbuehler over 7 years ago

Optimized buffer usage in mod_proxy (fixes #1850)

Revision 79e229c1 (diff)
Added by stbuehler over 7 years ago

Optimized buffer usage in mod_proxy (fixes #1850)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2365 152afb58-edef-0310-8abb-c4023f1b3aa9

History

#1 Updated by icy over 7 years ago

  • Target version set to 1.4.21
  • Pending changed from No to Yes

Looked over it and is valid, good find.
Thanks for looking over the source ycheng!

#2 Updated by stbuehler over 7 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2365.

Also available in: Atom