curl-library
Race condition if server responds during POST
Date: Tue, 18 Feb 2014 13:41:47 -0800
Hi,
I've observed that if I POST some data to a server and the server
responds before the data has been sent, then libcurl will receive the
response but wait 10 seconds before indicating completion.
Here's some debug output from my program:
21:26:16.167 curl: Trying 127.0.0.1...
21:26:16.167 curl: Connected to example.com (127.0.0.1) port 8000 (#0)
21:26:16.170 response header: Date: Tue, 18 Feb 2014 21:26:16 GMT
21:26:16.170 curl: Server Apache/2.2.22 (Ubuntu) is not blacklisted
21:26:16.170 response header: Server: Apache/2.2.22 (Ubuntu)
21:26:16.170 response header: WWW-Authenticate: Bearer
21:26:16.171 response header: Vary: Accept-Encoding
21:26:16.171 response header: Content-Encoding: gzip
21:26:16.171 response header: Transfer-Encoding: chunked
21:26:16.171 response header: Content-Type: text/html; charset=utf-8
21:26:16.172 curl: HTTP error before end of send, stop sending
21:26:16.172 writeFunction: accepting 13 bytes
21:26:16.172 socketFunction: CURL_POLL_IN 45
21:26:16.172 timerFunction: wake up in 0ms
21:26:16.173 timerFunction: wake up in 194ms
21:26:16.173 processMessages
21:26:16.173 processMessages
21:26:16.367 processMessages
21:26:26.170 curl: Closing connection 0
21:26:26.170 socketFunction: CURL_POLL_REMOVE 45
21:26:26.171 processMessages
21:26:26.171 got CURLMSG_DONE
Libcurl seems to recognize that a problem has happened ("stop sending"),
gives me the response data (writeFunction called with 13 bytes), but
then stalls. Eventually socketFunction is invoked to say the fd is no
longer needed, and if I read messages after that then I get
CURLMSG_DONE. I am able to reproduce this issue easily, and the delay is
always around 10 seconds. Maybe the 10 second delay is a helpful hint
about where to look inside libcurl?
I observed a bug like this in 7.22.0 so I compiled the latest git and
the issue is still there. Above debug output is from running against git
version.
Thanks,
Justin
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-18