On 5/1/2020 12:54 PM, Alex Shaver via curl-library wrote:
I have a server I connect to that may return one or more 102 'processing' messages to keep the connection alive while a long processing action is underway. Supposing the final message is a 200 response, when I check the curl status code, it returns 102 as the status.

I first noticed this while using pycurl, but I also tested using the curl command line tool, and got the same result. Fortunately, I can register a header callback and just manually parse the statuses myself. But this appears to be a bug as `CURLINFO_RESPONSE_CODE` is documented as returning the 'last' response code. Granted, the 'last' in that phrase may simply mean to the most recent 'request/response' process it ran, but it still feels like it could be improved. Or I may be misusing the tool. Advice on how to do it correctly would be appreciated, if it is not an error.


I can't reproduce this. libcurl should store the most recent code. [1] Can you please try the latest curl? [2]

Terminal 1:
while true; do perl -e 'print ("HTTP/1.1 102 Processing\r\nContent-Length: 0\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n")' | nc -4l localhost 8000; done

Terminal 2:
curl --write-out "%{http_code}" http://localhost:8000
200


[1]: https://github.com/curl/curl/blob/curl-7_70_0/lib/http.c#L3785-L3786
[2]: https://curl.haxx.se/download.html

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to