]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Account for some bytes handed to the network layer prior to
authorJeff Trawick <trawick@apache.org>
Fri, 21 Nov 2003 15:02:04 +0000 (15:02 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 21 Nov 2003 15:02:04 +0000 (15:02 +0000)
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
server/core.c

diff --git a/CHANGES b/CHANGES
index 01f4736accbd31281d8e1511985c91f28325e139..b8703b81062a5d110183b94b9f5b596871dc7102 100644 (file)
--- 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 <mj zermatt.net>]
 
index fd80a098859c3f01f9dd8ceb6f5c1ef57e420956..49b71b2ad3673663677f83cdb9e0ee89b248297b 100644 (file)
@@ -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;