diff options
author | Stefan Bühler <stbuehler@web.de> | 2015-02-07 13:32:54 +0000 |
---|---|---|
committer | Stefan Bühler <stbuehler@web.de> | 2015-02-07 13:32:54 +0000 |
commit | d00e1e79b94e0f4da35292d2293595dac02993c7 (patch) | |
tree | f4123ae29b2ecaab1f3fb5c4a6972e10d5b3c88f /src | |
parent | b0a632f253737463138c182a3fb9c8be04caef5d (diff) | |
download | lighttpd-git-d00e1e79b94e0f4da35292d2293595dac02993c7.tar.gz |
[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
Diffstat (limited to 'src')
-rw-r--r-- | src/connections.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/connections.c b/src/connections.c index bbaa632f..fe683a27 100644 --- a/src/connections.c +++ b/src/connections.c @@ -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; |