From ffd07ca67ceae72ab27ab2a65e73122b8c20e1c9 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Fri, 21 Nov 2003 15:02:04 +0000 Subject: [PATCH] Account for some bytes handed to the network layer prior to dropped connections. Such bytes were counted on some paths but not on others. If these bytes are to be counted in some error paths, they should be counted in the others. We don't know if they were actually presented to the client. AFAIK, this only affects mod_logio. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101832 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ server/core.c | 11 ++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 01f4736acc..b8703b8106 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) mod_logio: Account for some bytes handed to the network layer prior to + dropped connections. [Jeff Trawick] + *) Fix a problem with the display of empty variables ("SetEnv foo") in mod_include. PR 24734 [Markus Julen ] diff --git a/server/core.c b/server/core.c index fd80a09885..49b71b2ad3 100644 --- a/server/core.c +++ b/server/core.c @@ -2846,12 +2846,11 @@ static apr_status_t writev_it_all(apr_socket_t *s, /* XXX handle checking for non-blocking socket */ while (bytes_written != len) { rv = apr_socket_sendv(s, vec + i, nvec - i, &n); + *nbytes += n; bytes_written += n; if (rv != APR_SUCCESS) return rv; - *nbytes += n; - /* If the write did not complete, adjust the iovecs and issue * apr_socket_sendv again */ @@ -3002,8 +3001,7 @@ static apr_status_t emulate_sendfile(core_net_rec *c, apr_file_t *fd, rv = writev_it_all(c->client_socket, hdtr->headers, hdtr->numheaders, sendlen, &bytes_sent); - if (rv == APR_SUCCESS) - *nbytes += bytes_sent; /* track total bytes sent */ + *nbytes += bytes_sent; /* track total bytes sent */ } /* Seek the file to 'offset' */ @@ -3020,10 +3018,10 @@ static apr_status_t emulate_sendfile(core_net_rec *c, apr_file_t *fd, while (rv == APR_SUCCESS && sendlen) { bytes_sent = sendlen; rv = apr_socket_send(c->client_socket, &buffer[o], &bytes_sent); + *nbytes += bytes_sent; if (rv == APR_SUCCESS) { sendlen -= bytes_sent; /* sendlen != bytes_sent ==> partial write */ o += bytes_sent; /* o is where we are in the buffer */ - *nbytes += bytes_sent; togo -= bytes_sent; /* track how much of the file we've sent */ } } @@ -3040,8 +3038,7 @@ static apr_status_t emulate_sendfile(core_net_rec *c, apr_file_t *fd, } rv = writev_it_all(c->client_socket, hdtr->trailers, hdtr->numtrailers, sendlen, &bytes_sent); - if (rv == APR_SUCCESS) - *nbytes += bytes_sent; + *nbytes += bytes_sent; } return rv; -- 2.50.1