How to propagate the client connection close to the fcgi server?

Jim Johnstone (jimj@lexis-nexis.com)
Tue, 4 Feb 1997 14:30:10 -0500

Date: Tue, 4 Feb 1997 14:30:10 -0500
Message-Id: <199702041930.OAA10318@seahawks.lexis-nexis.com>
From: Jim Johnstone <jimj@lexis-nexis.com>
To: fastcgi-developers@OpenMarket.com
Subject: How to propagate the client connection close to the fcgi server?


The requirement to efficiently terminate fastCgi server processing when
the user clicks the browser "Stop" button has been leveraged on us (for
good reason, IMHO, as we have some pretty heavyweight fastCgi processing
going on). 

Near as I can tell, clicking the browser stop button causes the browser to
simply close the socket. It looks like mod_fastcgi is designed to keep
writing to the client (ignoring SIGPIPE) in spite of the closed socket.

from the comments to FastCGIDoWork

 *      If the Web server's client closes the connection prematurely,
 *      FastCGIDoWork carries on until the FastCGI application is
 *      done with the request.  This avoids the FastCGI application
 *      receiving SIGPIPE.

Now, what I'm proposing is making a custom copy of mod_fastcgi.c and
detecting this closed socket with poll or perhaps handling sigpipe, then
closing the socket to the fcgi server -- which will force it to handle
SIGPIPE, but thats OK, we can code to handle that.

Is there some reason why this won't work? Has somebody already implemented
such a mod and is willing to share some insight? 

Thanks in advance for your input, Jim

PS how often is mail to this list archived at //www.fastcgi.com/mail/?

Name: Jim Johnstone
Email: jimj@lexis-nexis.com
OS: Sun Solaris 2.5.1
Web Server: Apache Web Server Version: 1.2b6
FastCGI application's language: C++, Solaris 4.0.1
FastCGI Developer's Kit                 Version: 1.5.1
mod_fastcgi (if applicable)             Version: Got latest in late January
Directives:
    AppClass:
AppClass /project/tpf95/data1/dw/usr/jimj/www/fcgi/fcgiEcho.fcg -processes 1
AppClass /project/tpf95/data1/dw/usr/jimj/www/fcgi/fcgiLongTest.fcg -processes 1
AppClass /project/tpf95/data1/dw/usr/jimj/www/fcgi/fcgiEchoStderr.fcg -processes 1
    ExternalAppClass:
        None 
    Other:
        AddType application/x-httpd-fcgi fcg