lua-http
lua-http copied to clipboard
Client connection pooling
Should probably be done at the http.client level?
Need a 'multi-key' cache structure that allows us to index by a tuple of host, port, version, tls context, etc.
Need a way to know when connection is unused to add it back to a pool. EDIT: Now have connection:onidle
Misc things:
- When grabbing a http2 connection from the pool, may need to update settings.
- connections can be shared: http2 should be by default; but don't do http1 pipelining by default.
- Interaction with proxys?
- Should allow multiple connections per tuple
- low and high water marks?
- tie expiry of connection to expiry of cert? expiry of dns entry?
Curl's implementation:
- Most parameters: https://github.com/curl/curl/blob/f8be737d8f5276a6ab4c9560d896fb5585d2933e/lib/url.c#L1101
- SSL parameters:https://github.com/curl/curl/blob/f8be737d8f5276a6ab4c9560d896fb5585d2933e/lib/vtls/vtls.c#L86