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
Small fixes around the use of TCP MSS in http.client #67491
Comments
There are a couple of small issues with the determination of whether or not a request can fit in a single TCP/IP packet in http.client.
I suggest two changes be made to fix this:
This is still a best guess based on minimal TCP/IP header sizes, but if options or extension headers are used, the packet may still be split at the lower levels. This is fine because what we're trying to avoid is multiple send()s where the payload is less than the MSS. |
Or we should acknowledge that this is overkill, and take the same approach as all major web browser: disable the Nagle algorithm. |
I'm not opposed to that either. The only downside really (at least as far as I'm aware) is the potential substantial influx of packets should an iterable comprised of small chunks of data be passed in as the body, although I would consider that quite a strange edge case for HTTP requests. I'll put together another patch that disables nagle by default and see if anyone has a contrary opinion. |
I've attached a new patch disabling Nagle by default, but doing so in connect() as to allow users to override it if they really want to. I've also removed the use of mss in HTTPConnection. This is a backwards incompatible change in two ways:
That said, I do agree that this is a simpler, more portable choice to solve the problem. |
New changeset 42971b769c0b by Benjamin Peterson in branch 'default': |
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: