Zitat von William A Rowe Jr <wr...@rowe-clan.net>:

On Tue, May 3, 2016 at 9:31 AM, Michael Kaufmann <m...@michael-kaufmann.ch>
wrote:

Hi all,

a content generator module can detect client aborts and stream resets
while it reads the request body. But how can it detect this afterwards,
while the response is being generated?

This is important for HTTP/2, because the client may reset a stream, and
mod_http2 needs to wait for the content generator to finish. Therefore the
content generator should stop generating the response when it is no longer
needed.

Is there any API for this? The "conn_rec->aborted" flag exists, but which
Apache function sets this flag?

If there is no API, maybe an optional function for mod_http2 would be a
solution.


Nope - an optional function in mod_http2 is too special case, generators
must remain protocol (socket or other transport) agnostic.


Sure, official Apache modules should not call protocol-dependent hooks, but it could be a solution for 3rd party modules.

In the case of mod_cache'd content, the generator can't quit, it is already
populating a cache, which means you'll generate an invalid cached object.

But if you knew that the cache module wasn't collecting info, r->c->aborted
tells you if anyone is still listening, right?

Unfortunately not. While the content generator is running (just preparing the response, it is not reading from the input filters anymore and not writing to the output filters yet), Apache does not check the connection's state.

I'm not sure how mod_proxy deals with this - does it abort the backend request when the client closes the connection?

Reply via email to