httpc:request(get, {URL, []}, [], [{stream, FilePath}])
returns {ok, saved_to_file}
even when the remote web-service dies midway while streaming the response. I checked the content on the disk was missing a whole bunch of data. Is this a known quirk and expected?
Asked
Active
Viewed 222 times
3

sa___
- 363
- 2
- 12
-
I'm using OTP-22.1. I have tried `{sync, false}` option as well but it made no difference. – sa___ Apr 23 '20 at 17:13
-
You can use `cowboy_req`, it worked for me. – Hitesh Vaghani May 07 '20 at 13:07
1 Answers
1
I filed a bug-report and the answer from OTP team indicated it was a bug (atleast for the current HTTP spec):
I think this is due to that the client has backwards compatibility with servers that would close the connection to indicate that all data has been sent. Probably this should be made conditional for only old versions of the HTTP protocol or maybe it could be dropped... - Ingela Anderton Andin

sa___
- 363
- 2
- 12