mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Issue 4336: Let users of HTTPConnection.endheaders() submit a message body to the function if required.
This commit is contained in:
parent
7e876f5e93
commit
84040dbe81
2 changed files with 3 additions and 9 deletions
|
@ -1027,9 +1027,7 @@ class HTTPHandler(logging.Handler):
|
|||
h.putheader("Content-type",
|
||||
"application/x-www-form-urlencoded")
|
||||
h.putheader("Content-length", str(len(data)))
|
||||
h.endheaders()
|
||||
if self.method == "POST":
|
||||
h.send(data)
|
||||
h.endheaders(data if self.method == "POST" else None)
|
||||
h.getreply() #can't do anything with the result
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
raise
|
||||
|
|
|
@ -335,9 +335,7 @@ class URLopener:
|
|||
if auth: h.putheader('Authorization', 'Basic %s' % auth)
|
||||
if realhost: h.putheader('Host', realhost)
|
||||
for args in self.addheaders: h.putheader(*args)
|
||||
h.endheaders()
|
||||
if data is not None:
|
||||
h.send(data)
|
||||
h.endheaders(data)
|
||||
errcode, errmsg, headers = h.getreply()
|
||||
fp = h.getfile()
|
||||
if errcode == -1:
|
||||
|
@ -430,9 +428,7 @@ class URLopener:
|
|||
if auth: h.putheader('Authorization', 'Basic %s' % auth)
|
||||
if realhost: h.putheader('Host', realhost)
|
||||
for args in self.addheaders: h.putheader(*args)
|
||||
h.endheaders()
|
||||
if data is not None:
|
||||
h.send(data)
|
||||
h.endheaders(data)
|
||||
errcode, errmsg, headers = h.getreply()
|
||||
fp = h.getfile()
|
||||
if errcode == -1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue