We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
David A.114
9 years agoHelpful | Level 5
files/download giving 400 with an HTML page body from one host but not another
Hi,
I'm a developer on UpdraftPlus, a WordPress backup plugin with around 250,000 users who send to their Dropbox.
We're having a problem with a few users who, when trying to download the...
David A.114
9 years agoHelpful | Level 5
Hi Greg,
Thanks for the response. When you say that you want to see the raw HTML request, can you be more specific? I linked to a PHP script which reproduces the issue every time (when run from certain servers (but works every time from others) in my previous post; it's here: http://pastebin.com/FKbqK4Tx - there's only 6 lines of PHP needed from there to reproduce it (plus a few debug lines for more info). Were you wanting something different to that?
David
Greg-DB
Dropbox Community Moderator
9 years agoI'd specifically like to see the raw HTTP (not HTML) request for the API call that results in the 400 HTTP response (which happens to contain HTML).
I tried the script you provided, but it doesn't reproduce the issue on my machine.
I tried the script you provided, but it doesn't reproduce the issue on my machine.
- David A.1149 years agoHelpful | Level 5
Hi Greg,
Thanks. Working through that revealed the cause of the problem. When you POST to /2/files/download in the older version of Curl, with an empty body, Curl adds a header:
Content-Length: -1
The newer version of Curl does not add that header.
Explicitly adding a...
Content-Length: 0
... to the request avoids the problem. Switching to GET also avoids it (as in that case, there's no Content-Length header from the client).
I don't know which version of curl changed this behaviour. Perhaps if you tweak your API servers to treat negative content-lengths as equivalent to zero, that will help a few people out there.
David
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!