Bug #2196

mod_proxy caching data

Added by nishant over 4 years ago. Updated about 4 years ago.

Status:FixedStart date:2010-05-10
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:mod_proxy
Target version:1.4.27
Missing in 1.5.x:No

Description

Hi..

lighttpd version 1.4.26.

mod_proxy does not forward response until socket connection is closed with host proxy (it simply caches the data).

I did a fix but 'm not very sure how much generalized/stable it is (it is working fine in my scenario).

Please have a look at it & if the fix seems fine then a patch can be released.
The file is attached for reference.

==========================================================
CHANGES:
1.
function: static int proxy_demux_response(server *srv, handler_ctx *hctx)
change:
//PATCH ADDED FOR SENDING RESPONSE DATA.
//Check for Content-Length tag & data received is equal to Content-Length
if((con->parsed_response & HTTP_CONTENT_LENGTH) && (con->response.content_length == blen))
hctx->response->used = 0;

2. static handler_t proxy_write_request(server *srv, handler_ctx *hctx)
change:
case PROXY_STATE_READ:

//PATCH ADDED FOR SENDING RESPONSE DATA.
//IF ALL RESPONSE DATA IS READ SUCCESSFULLY.
if(hctx->response->used 0)
return HANDLER_GO_ON ;
else
/* waiting for a response */
return HANDLER_WAIT_FOR_EVENT;

3. SUBREQUEST_FUNC(mod_proxy_handle_subrequest)
change:
//PATCH ADDED FOR SENDING RESPONSE DATA.
case HANDLER_GO_ON:
return HANDLER_GO_ON;

========================================================

Regards,
~Nishant

mod_proxy.c Magnifier - Patched file -- to send response data back to lighty as soon as it read successfully from host proxy port. (35.3 KB) nishant, 2010-05-10 11:38

Associated revisions

Revision 2756
Added by stbuehler about 4 years ago

mod_proxy: return response as soon as it is available (fixes #2196)

History

#1 Updated by stbuehler about 4 years ago

  • Target version changed from 1.4.x to 1.4.27

#2 Updated by stbuehler about 4 years ago

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

Applied in changeset r2756.

Also available in: Atom