Comments (13)
Hi, I was wondering if this was still an issue or not since the pull request #1030 was actually closed?
Cheers.
from urllib3.
i think you can send files blocks at a time. if the body= of your request is a file like object, it will iteratively call .read() with a reasonable block size.
from urllib3.
[Deleted by shazow]
from urllib3.
[... Deleted by shazow]
Iterative block sending works not because urllib3 implements it, but because urllib3 hands off the body sending part to the builtin httplib module directly, which does support this.
I'll prove it. In ConnectionPool's urlrequest, body is passed along to ConnectionPool _make_request. _make_request accepts the body keyword arg into the httplib_request_kw keyword arg catcher. You'll notice that's passed on to conn.request. 'conn' here is of type HTTPConnection, straight from httplib.
In httplib, HTTPConnection request takes body and sends it to _send_request. _send_request takes body and passes it along to send. send accepts body as 'str', has a blocksize of 8192 hardcoded in, and if 'str' has a 'read' method defined on it, will loop on reading that blocksize.
from urllib3.
[Deleted by shazow]
from urllib3.
Please be respectful.
from urllib3.
Yes, please be nice as @kennethreitz said.
I don't recall the exact details of this off hand but what @jtolds sounds plausible. I will confirm this weekend and update this bug accordingly.
from urllib3.
The only way to properly add a form-data file to a request in urllib3 is by encode_multipart_formdata (filepost.py), there it writes the entire body of the outgoing request to a StringIO object, hence it pushes all of the file's contents in it.
httplib's send() will read/write this object block-by-block, but that doesn't help when the object is created this way.
from urllib3.
Gotcha. Yeah, multipart formdata is totally different than sending the file data directly in the body. I suppose that does require urllib3 support.
Of course, you could generate the request body data object yourself. It shouldn't be too difficult to make a file-like object that wraps a few files with some multipart formdata formatting business logic.
from urllib3.
There's an old stale branch where I tried to do this but I abandoned it due to too many edge cases. Might be worth taking another crack at it.
from urllib3.
I've added some more filepost tests to cover some of the edge cases, but I think there are a lot more: 5b1a8b7
@allover are you interested in taking a crack at this issue?
from urllib3.
This would be nice to have, anyone interested in working on it? (bump)
from urllib3.
This is being worked on in #1030
from urllib3.
Related Issues (20)
- Comment typo settimout settimeout HOT 1
- Dependency management issue HOT 2
- Fix test_redirecting_to_bad_url failure in Requests HOT 12
- NodeJS + pyodide support HOT 1
- Retry.respect_retry_after_header=False is not honored when retry is incremented HOT 1
- Unable to build the doc `Command sphinx-build -b html -W . _build/html failed with exit code 2` HOT 1
- Sunsetting official support for Python 2
- Change log for version 1.26.19
- publish.yml uses two different versions of actions/download-artifact HOT 1
- requests > 2.31 - TypeError: unhashable type: 'list'
- pyproject.toml specifies an illegal value in the "dynamic" field HOT 4
- Cannot pass host parameter to PoolManager HOT 1
- v2.0.5 is tagged strangely HOT 1
- Add support for HTTP/2 chunked request bodies HOT 1
- why this happens ?? HOT 1
- SSL Certificate Verification Error when Downloading YouTube Video HOT 2
- [Help]SSLEOFError(8, 'EOF occurred in violation of protoc ol (_ssl.c:1129)')) HOT 1
- Usage of `md5` in `util/ssl_.py` breaks in FIPS mode HOT 6
- bandcamp 403 with urllib-2.2.x (worked with urllib-1.26.x) HOT 6
- optimization request: _encode_invalid_chars is slow HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from urllib3.