mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
Send HTTP headers and message body in a single send() call.
This change addresses part of issue 4336. Change endheaders() to take an optional message_body argument that is sent along with the headers. Change xmlrpclib and httplib's other methods to use this new interface. It is more efficient to make a single send() call, which should get the entire client request into one packet (assuming it is smaller than the MTU) and will avoid the long pause for delayed ack following timeout. Also: - Add a comment about the buffer size for makefile(). - Extract _set_content_length() method and fix whitespace issues there.
This commit is contained in:
parent
21d2e59ab1
commit
0381f48936
2 changed files with 46 additions and 27 deletions
|
@ -1346,9 +1346,7 @@ class Transport:
|
|||
def send_content(self, connection, request_body):
|
||||
connection.putheader("Content-Type", "text/xml")
|
||||
connection.putheader("Content-Length", str(len(request_body)))
|
||||
connection.endheaders()
|
||||
if request_body:
|
||||
connection.send(request_body)
|
||||
connection.endheaders(request_body)
|
||||
|
||||
##
|
||||
# Parse response.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue