Ticket #1166 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

reversed condition in connections.c causes unwanted connection resets

Reported by: agrostis Assigned to: jan
Priority: normal Milestone: 1.4.17
Component: core Version: 1.4.15
Severity: normal Keywords:
Cc: Blocking:
Need Feedback: 0

Description

In the function connection_handle_write_prepare(), lines 537ff. of connections.c (rev. 1716) are as follows:

/* disable keep-alive if size-info for the body is missing */
if ((con->parsed_response & HTTP_CONTENT_LENGTH) &&
    ((con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) == 0)) {
	con->keep_alive = 0;
}

Given the intention stated in the comment, it is likely that the condition in line 538 is reversed, and the whole should rather read:

if ((!(con->parsed_response & HTTP_CONTENT_LENGTH)) &&
    ((con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) == 0)) {
	con->keep_alive = 0;
}

Indeed, as con->keep_alive seems to be never set back to 1 anywhere in connection_handle_write_prepare() (or elsewhere down the execution flow), lighttpd returns a Connection: close header and resets the connection even when the client sends a Connection: keep-alive request. Moreover, if an upstream handler (e.g. a process behind mod_fcgi) responds with a Connection: keep-alive header, the client gets the connection reset anyway.

Attachments

Change History

08/17/2007 03:39:14 PM changed by jan

  • status changed from new to closed.
  • resolution set to fixed.
  • pending changed.
  • milestone set to 1.4.17.

fixed in [1924]

The code below the mentioned on handle it correctly (a second time). This duplication was removed and replaced with the mentioned fix.


Add/Change #1166 (reversed condition in connections.c causes unwanted connection resets)




Change Properties
Action