Slow response to 304 NOT MODIFIED #63

jsdalton opened this Issue Jul 5, 2011 · 3 comments


None yet

2 participants

jsdalton commented Jul 5, 2011

I'm working with an API that returns a 304 when a requested resource identified by an etag has not been modified.

I observed an extremely slow response when accessing this resource, so I investigated further. There is an approximately a 5 second delay when response.body_string() is called. Following the path through the code, I isolated the issue to http.Unreader._data(). This method is just a wrapper around socket.recv().

I output the contents of socket.recv() and the following was output immediately.

Date: Tue, 05 Jul 2011 14:41:11 GMT
Server: WSGIServer/0.1 Python/2.6.1
Expires: Tue, 05 Jul 2011 14:41:11 GMT
Cache-Control: max-age=0

Then there was a pause of about 5 seconds before things proceeded.

It appears to me that the recv() is waiting for a response and is eventually timing out when it receives no new data. I wonder if it expects a body to follow after the headers have been sent?

Per the http spec: 304 actually must not contain a body. I wonder if this is the issue? It is the only thing I could guess...

benoitc commented Jul 5, 2011

can you try eventually with latest version of restkit ?

jsdalton commented Jul 5, 2011

Thanks. I updated to the master branch and it's working fine now.

I also sent you a pull request for a minor misspelling error. This was for the ResourceGone error you had added in response to an issue I filed a few weeks back.


Jim Dalton

On Jul 5, 2011, at 12:56 PM, benoitc wrote:

can you try eventually with latest version of restkit ?

Reply to this email directly or view it on GitHub:
#63 (comment)

benoitc commented Sep 8, 2011

thanks for the beedback. Sorry for the late answer, was a little out of time :)

@benoitc benoitc closed this Sep 8, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment