httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject [Patch] Keep Alive not workwing with mod_proxy (PR38602)
Date Sun, 12 Feb 2006 20:53:21 GMT
Currently I work on PR 38602 (http://issues.apache.org/bugzilla/show_bug.cgi?id=38602).
First of all the reporter is correct that we do not sent the
Connection: Keep-Alive
header on our HTTP/1.1 keep-alive connections to the backend.
But this is only the small part of the problem since 8.1.2 of the RFC says:

   "A significant difference between HTTP/1.1 and earlier versions of
   HTTP is that persistent connections are the default behavior of any
   HTTP connection. That is, unless otherwise indicated, the client
   SHOULD assume that the server will maintain a persistent connection,"

The real problem is that we actually *close* our connection to the backend
after each request (see line 1512 of mod_proxy_http.c) and if it would have
survived we would *close* it on the reusal of this connection:

lines 1852 - 1869 of proxy_util.c:

    if (r->proxyreq == PROXYREQ_PROXY || r->proxyreq == PROXYREQ_REVERSE ||
        !worker->is_address_reusable) {
        /*
         * TODO: Check if the connection can be reused
         */
        if (conn->connection) {
            if (conn->sock) {
                apr_socket_close(conn->sock);
                conn->sock = NULL;
            }
            apr_pool_cleanup_kill(conn->connection->pool, conn, connection_cleanup);
            conn->connection = NULL;
        }
        err = apr_sockaddr_info_get(&(conn->addr),
                                    conn->hostname, APR_UNSPEC,
                                    conn->port, 0,
                                    conn->pool);
    }

I tried to fix this behaviour and the attached patch works for me, but I have the slight
feeling that I stired up a hornet's nest :-). So a review and comments would be very
much appreciated to ensure that this does not break other things.


Regards

RĂ¼diger

Mime
View raw message