[connections] fix bug in connection state handling

if a request was finished (con->file_finished = 1) and the state
  machine was triggered, but the write queue was empty, it didn't
  actually finish the request.

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2973 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
Stefan Bühler 2015-02-07 13:32:54 +00:00
parent b0a632f253
commit d00e1e79b9
2 changed files with 10 additions and 13 deletions

1
NEWS
View File

@ -13,6 +13,7 @@ NEWS
* [ssl] disable SSL3.0 by default
* fixed typo in example config found by openSUSE user (boo# 907709)
* [network] fix compile break in calculation of sockaddr_un size if SUN_LEN is not defined (fixes #2609)
* [connections] fix bug in connection state handling
- 1.4.35 - 2014-03-12
* [network/ssl] fix build error if TLSEXT is disabled

View File

@ -1632,20 +1632,16 @@ int connection_state_machine(server *srv, connection *con) {
/* only try to write if we have something in the queue */
if (!chunkqueue_is_empty(con->write_queue)) {
#if 0
log_error_write(srv, __FILE__, __LINE__, "dsd",
con->fd,
"packets to write:",
con->write_queue->used);
#endif
}
if (!chunkqueue_is_empty(con->write_queue) && con->is_writable) {
if (-1 == connection_handle_write(srv, con)) {
log_error_write(srv, __FILE__, __LINE__, "ds",
con->fd,
"handle write failed.");
connection_set_state(srv, con, CON_STATE_ERROR);
if (con->is_writable) {
if (-1 == connection_handle_write(srv, con)) {
log_error_write(srv, __FILE__, __LINE__, "ds",
con->fd,
"handle write failed.");
connection_set_state(srv, con, CON_STATE_ERROR);
}
}
} else if (con->file_finished) {
connection_set_state(srv, con, CON_STATE_RESPONSE_END);
}
break;