How about something like this? I whipped this out very quickly and just did some quick compile and config-test tests on it... Comments before I commit sometime tomorrow:
Index: modules/proxy/mod_proxy_ajp.c =================================================================== --- modules/proxy/mod_proxy_ajp.c (revision 384045) +++ modules/proxy/mod_proxy_ajp.c (working copy) @@ -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,12 @@ * 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 +137,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 +245,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 +254,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 +323,13 @@ 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, 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 +355,7 @@ "proxy: error processing body"); isok = 0; } + /* XXX: what about flush here? See mod_jk */ data_sent = 1; break; default: Index: modules/proxy/proxy_util.c =================================================================== --- modules/proxy/proxy_util.c (revision 384045) +++ modules/proxy/proxy_util.c (working copy) @@ -1318,6 +1318,7 @@ (*worker)->hostname = uri.hostname; (*worker)->port = uri.port; (*worker)->id = proxy_lb_workers; + (*worker)->flush_packets = flush_off; /* Increase the total worker count */ proxy_lb_workers++; init_conn_pool(p, *worker); Index: modules/proxy/mod_proxy.c =================================================================== --- modules/proxy/mod_proxy.c (revision 384045) +++ modules/proxy/mod_proxy.c (working copy) @@ -218,6 +218,16 @@ } } } + 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 { return "unknown Worker parameter"; } Index: modules/proxy/mod_proxy.h =================================================================== --- modules/proxy/mod_proxy.h (revision 384045) +++ modules/proxy/mod_proxy.h (working copy) @@ -301,6 +301,11 @@ #if APR_HAS_THREADS apr_thread_mutex_t *mutex; /* Thread lock for updating address cache */ #endif + enum { + flush_off, + flush_on, + flush_auto + } flush_packets; /* how to deal with bad headers */ void *context; /* general purpose storage */ }; -- =========================================================================== Jim Jagielski [|] [EMAIL PROTECTED] [|] http://www.jaguNET.com/ "If you can dodge a wrench, you can dodge a ball."
