Closed mlogan closed 13 years ago
I think this is basically a timing issue related to receiving multiple chunks in the final packet, in which case the connection-closed callback is getting run before all of the buffered data has been processed. The close callback needs to wait until the buffers are empty (and/or we need a way to run read callbacks against all the buffered data in a single ioloop iteration).
If you run the following code:
You get the following exception:
However, there doesn't appear to be anything wrong with the imgur webserver. The request I paste into nc is the exact request that the tornado httpclient generates.
I have verified that the fetch code I provided above works with URLs on other servers - it even works with other imgur URLs, such as http://imgur.com/WMn80. imgur appears to return a very similar response to that URL - same Transfer-Encoding, same Server, same Connection headers, so I have no clue what could be going wrong in the former case.
Thanks, Mark