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

Add filename hinting to multipart encoder #316

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jhollowe
Copy link

@jhollowe jhollowe commented Oct 2, 2021

Allow the multipart encoder to do the same filename hinting as requests does.

Allow the multipart encoder to do the same filename hinting as `requests` does.
jhollowe added a commit to jhollowe/proxmoxer that referenced this pull request Oct 2, 2021
Until requests/toolbelt#316 is merged, this will allow requests_toolbelt to send all the data needed by Proxmox
jhollowe added a commit to proxmoxer/proxmoxer that referenced this pull request Oct 7, 2021
* Add switchover to requests_toolbelt for large file

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)

* Add patch for requests_tollbelt filename issue
  * Until requests/toolbelt#316 is merged, this will allow requests_toolbelt to send all the data needed by Proxmox

* Simplify large file handling

* Fix compatibility issues with older python versions

* Fix problem with non-JSON responses with errors

* Add multi-file safety and backup upload attempt

* 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)
@jhollowe
Copy link
Author

Any update to if this can be merged in?

@jhollowe
Copy link
Author

Can this be merged in?

@sigmavirus24
Copy link
Collaborator

Sorry for the delay @jhollowe

When you sent this CI was broken and I lost track of it. Can you rebase and push and add a test so this doesn't regress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants