Commit dcbe9564 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r1664071, r1664299 from trunk:

core: If explicitly configured, use the KeepaliveTimeout value of the
virtual host which handled the latest request on the connection, or by
default the one of the first virtual host bound to the same IP:port.

For non-async MPMs, use either r->server's or c->base_server's value in
ap_process_http_sync_connection() depending on a new server_rec's flag
called keep_alive_timeout_set and determined at config time.

For event MPM, use a queue per timeout value, chaining the queues per
type (keepalive wrt KeepAliveTimeout, write completion wrt to Timeout)
so that maintenance can be done on all the queues from the head, and such
that insertions/maintenance remain in O(1).
A server config is created and pointing to the queue of each vhost at
post_config time, hence the config can be associated to the connection
state (cs) at post_read_request time (keep_alive_timeout_set is used to
determine r->server vs c->base_server here), and we can simply insert
with TO_QUEUE_INSERT(cs->sc->q, cs).  PR56226.

While at it, since each queue now embeds it own timeout and hence the
expiration_time of the cs has changed to a queue_timestamp (the time it
was queued), we can detect clock skews and expire entries immediatly if
the system is set (eg. far) in the past during runtime and we want to
avoid waiting for (eg.) centuries before the current logic kills them.
Any entry which is registered above now + q->timeout is concerned, and
is now cleaned from the queue when encountered.  PR57374.


core: Follow up to r1664071: comments on new keep_alive_timeout_set flag.
Submitted by: ylavic
Reviewed/backported by: jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1670326 13f79535-47bb-0310-9956-ffa450edef68
parent 39136793
Loading
Loading
Loading
Loading
+5 −0
Changes for CHANGES: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -45,6 +45,11 @@ Changes with Apache 2.4.13
     finally close those not meant to be kept alive by SetEnv proxy-nokeepalive
     or force-proxy-request-1.0.  [Yann Ylavic]

  *) core: If explicitly configured, use the KeepaliveTimeout value of the
     virtual host which handled the latest request on the connection, or by
     default the one of the first virtual host bound to the same IP:port.
     PR56226.  [Yann Ylavic]

  *) mod_lua: After a r:wsupgrade(), mod_lua was not properly
     responding to a websockets PING but instead invoking the specified 
     script. PR57524. [Edward Lu <Chaosed0 gmail.com>]
+0 −9
Changes for STATUS: 0 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -106,15 +106,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) core: If explicitly configured, use the KeepaliveTimeout value of the
     virtual host which handled the latest request on the connection, or by
     default the one of the first virtual host bound to the same IP:port.
     PR 56226 + PR 57374.
     trunk patch: http://svn.apache.org/r1664071
                  http://svn.apache.org/r1664299
     2.4.x patch: http://people.apache.org/~ylavic/httpd-2.4.x-keep_alive_timeout_set.patch
     +1: ylavic, covener, jim

  *) core_filters: restore/disable TCP_NOPUSH option after non-blocking
     sendfile.
     trunk patch: http://svn.apache.org/r1669289
+3 −2
Changes for docs/manual/mod/core.xml: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -2195,8 +2195,9 @@ requests on a persistent connection</description>
    higher the timeout, the more server processes will be kept
    occupied waiting on connections with idle clients.</p>

    <p>In a name-based virtual host context, the value of the first
    defined virtual host best matching the local IP and port will be used.</p>
    <p>If <directive>KeepAliveTimeout</directive> is <strong>not</strong>
    set for a name-based virtual host, the value of the first defined
    virtual host best matching the local IP and port will be used.</p>
</usage>
</directivesynopsis>

+2 −1
Changes for include/ap_mmn.h: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -438,6 +438,7 @@
 * 20120211.40 (2.4.11-dev) Add ap_log_data(), ap_log_rdata(), etc.
 * 20120211.41 (2.4.11-dev) Add ap_proxy_de_socketfy to mod_proxy.h
 * 20120211.42 (2.4.13-dev) Add response_code_exprs to http_core.h
 * 20120211.43 (2.4.13-dev) Add keep_alive_timeout_set to server_rec
 */

#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -445,7 +446,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20120211
#endif
#define MODULE_MAGIC_NUMBER_MINOR 42                   /* 0...n */
#define MODULE_MAGIC_NUMBER_MINOR 43                   /* 0...n */

/**
 * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
+5 −1
Changes for include/httpd.h: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -1309,9 +1309,13 @@ struct server_rec {
    /** limit on number of request header fields  */
    int limit_req_fields;


    /** Opaque storage location */
    void *context;

    /** Whether the keepalive timeout is explicit (1) or
     *  inherited (0) from the base server (either first
     *  server on the same IP:port or main server) */
    unsigned int keep_alive_timeout_set:1;
};

/**
Loading