You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by pq...@apache.org on 2006/04/01 20:55:30 UTC

svn commit: r390728 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS include/ap_mmn.h modules/proxy/mod_proxy.c modules/proxy/mod_proxy.h modules/proxy/mod_proxy_ajp.c modules/proxy/proxy_util.c

Author: pquerna
Date: Sat Apr  1 10:55:28 2006
New Revision: 390728

URL: http://svn.apache.org/viewcvs?rev=390728&view=rev
Log:
Merge r384580, r390210 and r390619 from trunk, changing the flushing band-aid in mod_proxy_ajp to be configurable.

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/include/ap_mmn.h
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_ajp.c
    httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/CHANGES?rev=390728&r1=390727&r2=390728&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Sat Apr  1 10:55:28 2006
@@ -14,14 +14,19 @@
      made to ap_escape_html so we escape quotes.  Reported by JPCERT.
      [Mark Cox]
 
+  *) mod_proxy_ajp: Flushing of the output after each AJP chunk is now
+     configurable at runtime via the 'flushpackets' and 'flushwait' worker
+     params. Minor MMN bump. [Jim Jagielski]
+
   *) mod_proxy: Fix incorrect usage of local and shared worker init.
      PR 38403. [Jim Jagielski]
 
   *) mod_isapi: Fix compiler errors on Unix platforms.
      [William Rowe]
 
-  *) mod_proxy_http: Send HTTP Keep-Alive Headers. PR 38524.
-     [Rüdiger Plüm, Joe Orton]
+  *) mod_proxy_http: Do send keep-alive header if the client sent
+     connection: keep-alive and do not close backend connection if the client
+     sent connection: close. PR 38524. [Ruediger Pluem, Joe Orton]
 
   *) mod_disk_cache: Return the correct error codes from bucket read 
      failures, instead of APR_EGENERAL.

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/STATUS?rev=390728&r1=390727&r2=390728&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Sat Apr  1 10:55:28 2006
@@ -73,22 +73,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-    * mod_proxy_ajp: Remove the Flushing Bandaid from compile time
-      to a more admin-friendly runtime setting.
-         http://svn.apache.org/viewcvs?rev=384580&view=rev
-         http://svn.apache.org/viewcvs?rev=390210&view=rev
-         http://svn.apache.org/viewcvs?rev=390619&view=rev
-      +1: jim, rpluem, pquerna
-      pquerna says: Why is this configuration for AJP polluting mod_proxy.h?
-                    Shouldn't we be keeping the configuration of a Proxy Provider
-                    separate from the main mod_proxy?
-      rpluem says:  Because this configuration option should be also used for
-                    HTTP and possibly other protocols in the future. Just
-                    did not have the time to do so for HTTP (which has frequent
-                    request / complains for this feature). See also
-                    http://mail-archives.apache.org/mod_mbox/httpd-dev/200603.mbox/%3c200603092321.k29NLIi05689@devsys.jaguNET.com%3e
-
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
 
     * mod_dbd: When threaded, create a private pool in child_init

Modified: httpd/httpd/branches/2.2.x/include/ap_mmn.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/include/ap_mmn.h?rev=390728&r1=390727&r2=390728&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/include/ap_mmn.h (original)
+++ httpd/httpd/branches/2.2.x/include/ap_mmn.h Sat Apr  1 10:55:28 2006
@@ -107,6 +107,8 @@
  * 20050708.1 (2.1.7-dev) add proxy request_status hook (minor)
  * 20051006.0 (2.1.8-dev) NET_TIME filter eliminated
  * 20051115.0 (2.1.10-dev/2.2.0) add use_canonical_phys_port to core_dir_config
+ * 20051115.1 (2.2.1)  flush_packets and flush_wait members added to
+ *                         proxy_server (minor)
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */
@@ -114,7 +116,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20051115
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 0                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 1                     /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c?rev=390728&r1=390727&r2=390728&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c Sat Apr  1 10:55:28 2006
@@ -218,6 +218,26 @@
             }
         }
     }
+    else if (!strcasecmp(key, "flushpackets")) {
+        if (!strcasecmp(val, "on"))
+            worker->flush_packets = flush_on;
+        else if (!strcasecmp(val, "off"))
+            worker->flush_packets = flush_off;
+        else if (!strcasecmp(val, "auto"))
+            worker->flush_packets = flush_auto;
+        else
+            return "flushpackets must be on|off|auto";
+    }
+    else if (!strcasecmp(key, "flushwait")) {
+        ival = atoi(val);
+        if (ival > 1000 || ival < 0) {
+            return "flushwait must be <= 1000, or 0 for system default of 10 millseconds.";
+        }
+        if (ival == 0)
+            worker->flush_wait = PROXY_FLUSH_WAIT;
+        else
+            worker->flush_wait = ival * 1000;    /* change to microseconds */
+    }
     else {
         return "unknown Worker parameter";
     }

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h?rev=390728&r1=390727&r2=390728&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.h Sat Apr  1 10:55:28 2006
@@ -301,8 +301,20 @@
 #if APR_HAS_THREADS
     apr_thread_mutex_t  *mutex;  /* Thread lock for updating address cache */
 #endif
-    void            *context;   /* general purpose storage */
+    void                *context;   /* general purpose storage */
+    enum {
+         flush_off,
+         flush_on,
+         flush_auto
+    } flush_packets;           /* control AJP flushing */
+    int                 flush_wait;  /* poll wait time in microseconds if flush_auto */
 };
+
+/*
+ * Wait 10000 microseconds to find out if more data is currently
+ * available at the backend. Just an arbitrary choose.
+ */
+#define PROXY_FLUSH_WAIT 10000
 
 struct proxy_balancer {
     apr_array_header_t *workers; /* array of proxy_workers */

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_ajp.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_ajp.c?rev=390728&r1=390727&r2=390728&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_ajp.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy_ajp.c Sat Apr  1 10:55:28 2006
@@ -90,7 +90,7 @@
 }
 
 /*
- * XXX: Flushing bandaid
+ * XXX: AJP Auto Flushing
  *
  * When processing CMD_AJP13_SEND_BODY_CHUNK AJP messages we will do a poll
  * with FLUSH_WAIT miliseconds timeout to determine if more data is currently
@@ -105,15 +105,6 @@
  * For further discussion see PR37100.
  * http://issues.apache.org/bugzilla/show_bug.cgi?id=37100
  */
-#define FLUSHING_BANDAID 1
-
-#ifdef FLUSHING_BANDAID
-/*
- * Wait 10000 microseconds to find out if more data is currently
- * available at the backend. Just an arbitrary choose.
- */
-#define FLUSH_WAIT 10000
-#endif
 
 /*
  * process the request and write the response.
@@ -140,10 +131,8 @@
     apr_off_t bb_len;
     int data_sent = 0;
     int rv = 0;
-#ifdef FLUSHING_BANDAID
     apr_int32_t conn_poll_fd;
     apr_pollfd_t *conn_poll;
-#endif
 
     /*
      * Send the AJP request to the remote server
@@ -250,9 +239,8 @@
     result = ajp_parse_type(r, conn->data);
     output_brigade = apr_brigade_create(p, r->connection->bucket_alloc);
 
-#ifdef FLUSHING_BANDAID
     /*
-     * Prepare apr_pollfd_t struct for later check if there is currently
+     * Prepare apr_pollfd_t struct for possible later check if there is currently
      * data available from the backend (do not flush response to client)
      * or not (flush response to client)
      */
@@ -260,7 +248,6 @@
     conn_poll->reqevents = APR_POLLIN;
     conn_poll->desc_type = APR_POLL_SOCKET;
     conn_poll->desc.s = conn->sock;
-#endif
 
     bufsiz = AJP13_MAX_SEND_BODY_SZ;
     while (isok) {
@@ -330,17 +317,14 @@
                                                     r->connection->bucket_alloc);
                     APR_BRIGADE_INSERT_TAIL(output_brigade, e);
 
-#ifdef FLUSHING_BANDAID
-                    /*
-                     * If there is no more data available from backend side
-                     * currently, flush response to client.
-                     */
-                    if (apr_poll(conn_poll, 1, &conn_poll_fd, FLUSH_WAIT)
-                        == APR_TIMEUP) {
+                    if ( (conn->worker->flush_packets == flush_on) ||
+                         ( (conn->worker->flush_packets == flush_auto) &&
+                           (apr_poll(conn_poll, 1, &conn_poll_fd,
+                                     conn->worker->flush_wait)
+                             == APR_TIMEUP) ) ) {
                         e = apr_bucket_flush_create(r->connection->bucket_alloc);
                         APR_BRIGADE_INSERT_TAIL(output_brigade, e);
                     }
-#endif
                     apr_brigade_length(output_brigade, 0, &bb_len);
                     if (bb_len != -1)
                         conn->worker->s->read += bb_len;
@@ -366,6 +350,7 @@
                                   "proxy: error processing body");
                     isok = 0;
                 }
+                /* XXX: what about flush here? See mod_jk */
                 data_sent = 1;
                 break;
             default:

Modified: httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c?rev=390728&r1=390727&r2=390728&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/proxy_util.c Sat Apr  1 10:55:28 2006
@@ -1318,6 +1318,8 @@
     (*worker)->hostname = uri.hostname;
     (*worker)->port = uri.port;
     (*worker)->id   = proxy_lb_workers;
+    (*worker)->flush_packets = flush_off;
+    (*worker)->flush_wait = PROXY_FLUSH_WAIT;
     /* Increase the total worker count */
     proxy_lb_workers++;
     init_conn_pool(p, *worker);