Title: http.client no longer sends HTTP request in one TCP package
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, christian.heimes, orsenthil
Priority: normal Keywords: 3.5regression

Created on 2018-03-13 12:06 by christian.heimes, last changed 2018-03-13 17:40 by orsenthil.

Messages (1)
msg313743 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2018-03-13 12:06 changed how http.client sends request. endheaders() no longer sends header and message body in one TCP package if the total payload is smaller than TCP max segment size. uses two send calls to send header and body. This causes very simple HTTP servers in embedded devices to fail.

Matthew Garrett noticed the bug, see /

We should try to send requests as one TCP package again. TCP_CORK may do the trick. Or we should fix our custom implementation of send. It has multiple issues, e.g. a fixed buffer. The buffer size is suboptimal for small MTU and jumbo frames.
Date User Action Args
2018-03-13 17:40:23orsenthilsetnosy: + orsenthil
2018-03-13 12:06:43christian.heimescreate