Project

General

Profile

Actions

Bug #1166

closed

reversed condition in connections.c causes unwanted connection resets

Added by agrostis almost 17 years ago. Updated over 16 years ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

In the function {{{connection_handle_write_prepare()}}}, "lines 537ff. of connections.c":source:tags/lighttpd-1.4.15/src/connections.c@current#L537 (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.

Actions #1

Updated by jan over 16 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

fixed in r1924

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

Actions

Also available in: Atom