Making io.BufferedReader buffer available

Hi, I pushed http.client to a scenario where I would read streaming HTTP data (yeah, without going into native async) with a select() on HTTPResponse and using its read1(). Because HTTPResponse has a fileno() we're tempted to use select() on it, which works kind-of well... but there is one edge case. While consuming the HTTP response headers, HTTPResponse performs the buffered reading of the response (made by socket.makefile()) which may leave pending buffered payload data. In that case and when no more data is coming just yet, the select() is blocking despite some data available in buffers. While it's possible to set a custom HTTP response class in http.client, it would seem interesting (but I may be lacking background) to be able to retrieve the pending buffered data using arguments to peek() or read() on a BufferedReader, without accessing the underlying stream. What do you think? Regards, -- Jérôme
participants (1)
-
Jérôme Carretero