If a head command is issued, then no data (including the headers) is
written to the client.  Also, the length of the headers is subtracted from
the sent bytes count in the conn, causing the sent bytes count to go
negative (except that in nslog/nslog.c, the count is rendered as an
unsigned, so it appears to be a very big number, or else my DSL line just
got _really_ fast).

The enclosed patch does two things:

       - When sending data, if the data is null, send the headers anyway.
       - Count the headers in the sent bytes count.

I'm not sure why the headers were excluded from the count, so someone
should check this.

This was why I thought my virtual server patch was broken, but it doesn't
have anything to do with that.

Patch follows:

diff -ur aolserver/nsd/return.c aolserver-vsfix/nsd/return.c
--- aolserver/nsd/return.c      Sat Sep 28 15:24:31 2002
+++ aolserver-vsfix/nsd/return.c        Mon Jan 13 23:39:43 2003
@@ -260,7 +260,6 @@
        connPtr->responseStatus = status;
        if (!(conn->flags & NS_CONN_SKIPHDRS)) {
            Ns_ConnConstructHeaders(conn, &connPtr->queued);
-           connPtr->nContentSent -= connPtr->queued.length;
        }
        conn->flags |= NS_CONN_SENTHDRS;
     }
@@ -706,6 +705,8 @@
     result = NS_OK;
     if (data != NULL && !(conn->flags & NS_CONN_SKIPBODY)) {
        result = Ns_WriteConn(conn, data, len);
+    } else {
+       result = Ns_WriteConn(conn, NULL, 0);
     }
     if (result == NS_OK) {
        result = Ns_ConnClose(conn);

Reply via email to