[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
NSURLConnection delays 30 seconds before returning chunked-mode response
From: |
Jens Alfke |
Subject: |
NSURLConnection delays 30 seconds before returning chunked-mode response |
Date: |
Thu, 1 Mar 2012 17:32:43 -0800 |
The chunked-mode parser in GNUstep seems to have trouble detecting EOF. What
I’m seeing when I use NSURLConnection to GET a resource whose response is
chunked, is that the data is fetched immediately, and then there’s an exactly
30-second delay before the delegate is called.
Here’s part of a transcript with NSURLProtocol debug mode turned on. Note that
the first logged message contains the entire response (including the
zero-length chunk that signifies EOF), and then after a delay of exactly 29.997
seconds the protocol reports reading another zero bytes (?!) Immediately after
that second message my delegate method is called with the response body.
Anyone know for sure what’s going on here? My guess is that (a) the
chunked-mode parser doesn’t convey to the NSURLProtocol that the end of the
response has been reached; and then (b) after 30 seconds of inactivity the
remote server closes the socket, triggering the protocol to realize that it’s
got the entire response. If that’s so, I’m still not sure how to fix the
problem…
—Jens
2012-03-01 17:24:46.670 TouchTool[30208] <_NSHTTPURLProtocol: 0xa09c754>
<NSMutableURLRequest
http://localhost:5984/tdreplicator_test/_changes?feed=normal&heartbeat=300000>
read 463 bytes: 'HTTP/1.1 200 OK
Transfer-Encoding: chunked
Server: CouchDB/1.0.1 (Erlang OTP/R14B)
Etag: "232EXBKRG928QS4C4KIACCBMW"
Date: Fri, 02 Mar 2012 01:24:46 GMT
Content-Type: text/plain;charset=utf-8
Cache-Control: must-revalidate
d
{"results":[
52
{"seq":1,"id":"doc1","changes":[{"rev":"2-2185185b-3524-4c9a-a82f-74fb2b5a1a5a"}]}
54
,
{"seq":2,"id":"doc2","changes":[{"rev":"1-c276813e-0484-4469-8acd-da72c91e6379"}]}
12
],
"last_seq":2}
1
0
'
2012-03-01 17:25:16.667 TouchTool[30208] <_NSHTTPURLProtocol: 0xa09c754>
<NSMutableURLRequest
http://localhost:5984/tdreplicator_test/_changes?feed=normal&heartbeat=300000>
read 0 bytes: ''
smime.p7s
Description: S/MIME cryptographic signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- NSURLConnection delays 30 seconds before returning chunked-mode response,
Jens Alfke <=