-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Configurable blocksize in HTTP(S)Connection #76126
Comments
blocksize is hardcoded to 8192 in send() and _read_readable(), preventing Users of the module that are not interested in chunked encoding can rewrite conn = HTTPSConnection(...)
conn.putrequest(...)
conn.putheader(...)
conn.endheaders()
while True:
chunk = file.read(512*1024)
if not chunk:
break
conn.send(chunk) But fixing send() to use a configurable blocksize seems more useful. Also, users of requests do not have access the underlying connection, so When reading from /dev/zero and uploading to server that drop the received |
When using highlevel request() api, users can control the block size by class FileIter:
def __init__(self, file, blocksize):
self.file = file
self.blocksize = blocksize
def __iter__(self):
while True:
datablock = self.file.read(self.blocksize)
if not datablock:
break
yield datablock Adding configurable block size will avoid this workaround. |
Thank you Nir Soffer for this nice enhancement. Sadly, since it's a new feature, it cannot be backport to Python 3.6 nor 2.7, since it's a new feature. |
The commit message contains much more information than the NEWS and What's New entries. Maybe the What's New entry can be completed, I don't know. In the meanwhile, I close the issue :-) Nir: Feel free to create a new PR if you want to complete the What's New entry ;-) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: