You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joe Orton <jo...@redhat.com> on 2005/06/27 21:25:38 UTC

Re: svn commit: r202027 - in /httpd/httpd/trunk: CHANGES server/mpm_common.c

On Mon, Jun 27, 2005 at 06:40:59PM -0000, Paul Querna wrote:
> Author: pquerna
> Date: Mon Jun 27 11:40:56 2005
> New Revision: 202027
> 
> URL: http://svn.apache.org/viewcvs?rev=202027&view=rev Log: *) 
> server/mpm_common.c: Send a simple HTTP 1.0 request to every listener 
> socket, instead of just closing the socket.  This fixes shutdown of 
> the Worker MPM on FreeBSD, when Accept Filters are enabled.

Yow, nice catch!

> --- httpd/httpd/trunk/server/mpm_common.c (original)
> +++ httpd/httpd/trunk/server/mpm_common.c Mon Jun 27 11:40:56 2005
> @@ -546,6 +546,7 @@
>   */
>  static apr_status_t dummy_connection(ap_pod_t *pod)
>  {
> +    const char* srequest = "GET / HTTP/1.0\r\n\r\n";

Here's your favourite star-space trick ;)

>      apr_status_t rv;
>      apr_socket_t *sock;
>      apr_pool_t *p;
> @@ -596,6 +597,16 @@
>                       "connect to listener on %pI", ap_listeners->bind_addr);
>      }
>  
> +    /* Since some operating systems support buffering of data or entire 
> +     * requests in the kernel, we send a simple request, to make sure 
> +     * the server pops out of a blocking accept(). 
> +     */
> +    /* XXX: This is HTTP specific. We should look at the Protocol for each 
> +     * listener, and send the correct type of request to trigger any Accept
> +     * Filters.
> +     */
> +    apr_socket_send(sock, srequest, strlen(srequest));
> +    apr_socket_shutdown(sock, APR_SHUTDOWN_WRITE);

Why call shutdown as well as close?  close does an implicit shutdown 
anyway.

>      apr_socket_close(sock);
>      apr_pool_destroy(p);