Connection API?

Maxim Dounin mdounin at mdounin.ru
Mon Dec 3 14:42:48 UTC 2012


Hello!

On Sat, Dec 01, 2012 at 12:19:36AM +0000, Nick Kew wrote:

> I'm looking to port a module to nginx.  The module currently
> exists for Apache Trafficserver and Apache HTTPD.
> 
> Part of the module hooks into the start and end of the
> TCP connection, and maintains connection data in a connection
> context.  As far as I can tell, there's no equivalent API in
> nginx: there's no ctx to store context in ngx_connection_t,
> nor are there hooks to insert my modules functions at the start
> and end of a connection.
> 
> (a) Is there really no connection API, or am I just missing it?
> (b) If there really is no such API, would the nginx core team
>     be receptive to a patch introducing it?  I would envisage
>     a ctx in the connection struct, and a hookable
>     start-connection event.

As of now connection end may be hooked by using connection's pool 
cleanup handler.  There is no connection start hook in the current 
http module API.

It's probably worth adding, but I doubt we need full-featured API 
here.  In particular, full ctx array would be huge compared to a 
connection structure size which is kept small to minimize 
keepalive connections costs.  And the demand for a connection start 
hook looks extremelay low.

-- 
Maxim Dounin
http://nginx.com/support.html



More information about the nginx-devel mailing list