Change @sess_pool from an Array to a Hash with Site as a key. Each value is an Array of sessions. This should improve cache access performance if multiple sites are in cache. In addition to the change, do scrub the cache every @keep_alive_timeout seconds. This also should improve cache access performance since it was scrubbing the cache every time. See #69
MRU is more server friendly than LRU because it reduces number of cached sessions when a number of requests drops after an usaage spike. Closes #68. With reusing sessions in LRU order, all sessions are equally checked if it's closed or not, as far as there's a request to the same site. With reusing sessions in MRU order, old cold sessions are kept in cache long time even if there's a request to the same site. To avoid this leakage, this commit adds keep_alive_timeout property and let SessionManager scrub all sessions with checking the timeout for each session. When the session expires against the last used time, it's closed and collected. keep_alive_timeout is 15[sec] by default. The value is from the default value for KeepAliveTimeout of Apache httpd 2. This change is related to #56.
I should say 'httpclient does not run on rbx' at this moment. - rubinius/rubinius#689 - http://travis-ci.org/#!/nahi/httpclient/builds/85213
For chunked encoding, we didn't check it. For non-chunked encoding, it was closed at get_body but there was a chance not closed if the session is keep-alive. Close #51.
…to :size 1. There is no need to send query with Transfer-Encoding: chuncked when IO respond to :size. 2. Lighttpd does not support PUT, POST with Transfer-Encoding: chuncked. You will see that the lighty respond with 200 OK, but there is a file whose size is zero... LIMITATION: timeout occurs certainly when you send very large file and @send_timeout is default since HTTPClient::Session#query() assumes that *all* write are finished in @send_timeout sec not each write. WORKAROUND: increment @send_timeout and @receive_timeout or set @send_timeout and @receive_timeout to 0 not to be timeout.