custom logic after connection is closed

nemster nginx-forum at forum.nginx.org
Mon Nov 14 12:55:39 UTC 2016


Hi Maxim,

Maxim Dounin Wrote:
-------------------------------------------------------
> Hello!
> 
> On Mon, Nov 14, 2016 at 05:08:33AM -0500, nemster wrote:
> 
> > Hi!
> > Is it possible to write a plugin that does some additional stuff
> after a TLS
> > (http/1.1, http/2.0) TCP connection. 
> > I would want to keep some extra struct for each TLS connection and
> > manipulated it with every request, then once the TLS (or TCP)
> connection
> > closes i would want to do some processing and cleanup.
> 
> You can install a pool cleanup handler on a connection pool.  Grep 
> sources for ngx_pool_cleanup_add() for usage examples.

looks like a good candidate, however from what i understand in
ngx_http_close_connection that is kicked of in the end when ngx_destroy_pool
is called.
however the TLS session is deleted after that. ideally i would want access
to TLS Parameters such as TLS Session Cookie and the crypto params.

I could log them maybe at session start and then finalize only in the pool
cleanup handler, but that would basically double that data in memory for no
reason.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,270918,270924#msg-270924



More information about the nginx mailing list