Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support uploading large files #68

Merged
merged 6 commits into from
Oct 7, 2021

Conversation

jhollowe
Copy link
Contributor

@jhollowe jhollowe commented Oct 2, 2021

This PR allows a switchover to the streaming multipart payload provided by requests_toolbelt (if installed) for files larger than supported by requests on its own.

depends-on requests/toolbelt#316 for full functionality with Proxmox
resolves #67

When requests handles files, it reads the entire file into memory and sends in a single payload.
Currently the python SSL tooling does not support single payloads larger than 2^31-1 bytes (https://bugs.python.org/issue42853#msg384566)
This means that files ~ >= 2GiB cannot be sent using requests

This commit allows a switchover to the streaming multipart payload provided by requests_toolbelt (if installed)
@jhollowe jhollowe added type:bug 🐞 The software does not function as intended type:enhancement ⏫ New or updated feature/functionality backend:https labels Oct 2, 2021
@jhollowe jhollowe added this to the Future Release milestone Oct 2, 2021
@jhollowe jhollowe self-assigned this Oct 2, 2021
@jhollowe jhollowe added this to In progress in Roadmap via automation Oct 2, 2021
Until requests/toolbelt#316 is merged, this will allow requests_toolbelt to send all the data needed by Proxmox
* Checks the total file size, not just the size of each file
* Throws OverflowError if payload will be too large for SSL
* Suggests using `requests_toolbelt` for medium-large files, but uses `requests` with the associated memory hogging
* Uses `requests` for uploads under a threshold (currently 10MiB)
Roadmap automation moved this from In progress to Reviewer approved Oct 4, 2021
@jhollowe
Copy link
Contributor Author

jhollowe commented Oct 7, 2021

Tests just failing due to coverage reduction. I'll work on tests later.

@jhollowe jhollowe merged commit fc5ead8 into proxmoxer:develop Oct 7, 2021
Roadmap automation moved this from Reviewer approved to Done Oct 7, 2021
@jhollowe jhollowe deleted the issue-67_large-file-upload branch January 30, 2022 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:https type:bug 🐞 The software does not function as intended type:enhancement ⏫ New or updated feature/functionality
Projects
Roadmap
  
Done
Development

Successfully merging this pull request may close these issues.

Uploading large files causes OverflowError
2 participants