JuliaLang / Downloads.jl

MIT License
89 stars 34 forks source link

Header `Expect: 100-continue` #221

Open lbilli opened 1 year ago

lbilli commented 1 year ago

I recently started having problems with POST requests to a particular server. The issue wasn't happening in the past but I'm not sure whether this failure was triggered by an update on my end or the remote server has changed behavior.

My current setup is Julia 1.9.0-rc1.

What happens is that POST requests to this particular server done with Downloads.request() fail whereas the same requests sent with the command line curl or R package curl (both linked to libcurl 7.88.1) or even Firefox succeed.

After a bit of a struggle I was able to find out that Julia's Downloads / LibCURL silently inject the header Expect: 100-continue in the request, which seems to be what confuses the server.

By adding the header "Expect" => nothing, which effectively disable the header, all is working again.

Interestingly, neither curl (at least version 7.88.1) nor the browser add this header and so I wonder why the different default behavior.

On a side note, in order to diagnose this issue, http echo servers like httpbin.org are of no use as they do not report this particular header.