Folks,
I'm seeing a bizarre case when using CFNetwork with kCFStreamPropertyHTTPAttemptPersistentConnection. It looks like under some circumstances, it is possible for an HTTP POST request to be sent twice, even though the code has only initiated a single request.
WireShark trace overview:
(will send full trace file on request -- I don't want to share it with the world)
In this trace, the following notable events occur (indexed by No. column)
1. Connection is established on client port 65448
5. First HTTP post to 216.33.246.69 is sent
12. Successful response received
15. Second HTTP post is sent on same connection
16. Client immediately sends FIN, ACK to close connection
18. Client opens new connection on client port 65455
25. Client duplicates exact same request sent in 15
40. Server finishes reply to 15.
50. Server finishes reply to 25 (shorter payload, due to server error from overlapping requests).
From the client code perspective, we only see the reply to 50, and the first request is hidden from view.
Turning off kCFStreamPropertyHTTPAttemptPersistentConnection seems to avoid the issue, but I would prefer to be able to use persistent connections. This request duplication is potentially quite dangerous, so I'd like to get a handle on it.
Ladd Van Tol | Principal MTS | eBay Mobile | email@hidden | 503.265.1214 | quuxly (skype)
|