[core] fix request_start in keep-alive requests to mark time when received first byte (fixes #2412)

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

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3111 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/heads/lighttpd-1.4.x
Stefan Bühler 2016-03-19 15:01:21 +00:00
parent cfd13c7938
commit 6f89a8bbef
2 changed files with 7 additions and 0 deletions

1
NEWS
View File

@ -39,6 +39,7 @@ NEWS
* restart (some) syscalls after SIGCHLD interrupted them; should fix LDAP problems (fixes #2464)
* [core] log remote address on request timeouts (fixes #652)
* [autobuild] use AC_CANONICAL_HOST instead of AC_CANONICAL_TARGET (fixes #1866)
* [core] fix request_start in keep-alive requests to mark time when received first byte (fixes #2412)
- 1.4.39 - 2016-01-02
* [core] fix memset_s call (fixes #2698)

View File

@ -891,6 +891,8 @@ static int connection_handle_read_state(server *srv, connection *con) {
chunkqueue *cq = con->read_queue;
chunkqueue *dst_cq = con->request_content_queue;
int is_closed = 0; /* the connection got closed, if we don't have a complete header, -> error */
/* when in CON_STATE_READ: about to receive first byte for a request: */
int is_request_start = chunkqueue_is_empty(cq);
if (con->is_readable) {
con->read_idle_ts = srv->cur_ts;
@ -913,6 +915,10 @@ static int connection_handle_read_state(server *srv, connection *con) {
switch(ostate) {
case CON_STATE_READ:
/* update request_start timestamp when first byte of
* next request is received on a keep-alive connection */
if (con->request_count > 1 && is_request_start) con->request_start = srv->cur_ts;
/* if there is a \r\n\r\n in the chunkqueue
*
* scan the chunk-queue twice