-
Couldn't load subscription status.
- Fork 218
Description
When the SDK makes an HTTP request to any of the upload URLs and the HTTP response is 307 Temporary Redirect, or possibly any other redirection, the SDK correctly follows the redirection but drops the HTTP message body, causing the server to respond with a client error.
A real-world scenario could be a proxy server sitting between the client and the server, needing to authenticate the upload URL, redirecting the client to perform authentication before allowing the client to proceed with the request. In this case, the SDK would POST the usual multipart/form-data to https://upload.box.com/api/2.0/files/content, receive a 307 Temporary Redirect, and POST to Location without the HTTP message body, which is incorrect.
A few observations:
- A quick glance at the SDK's source code suggests that the issue is that the stream used for uploads by the SDK is not rewindable.
- Requests works correctly. Requests correctly follows the redirection and maintains the HTTP message body. Requests had this bug in 2016, but it was fixed: requests gets stuck on post redirect where data is readable psf/requests#3079
- The auto-generated Python SDK has the same problem.