mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Merged revisions 85169 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r85169 | senthil.kumaran | 2010-10-02 16:03:13 +0530 (Sat, 02 Oct 2010) | 3 lines Use proper variable name 'data' instead of 'str' in the send method. ........
This commit is contained in:
parent
d8d1cea561
commit
996e13c838
1 changed files with 10 additions and 10 deletions
|
|
@ -724,8 +724,8 @@ class HTTPConnection:
|
||||||
self.__response = None
|
self.__response = None
|
||||||
self.__state = _CS_IDLE
|
self.__state = _CS_IDLE
|
||||||
|
|
||||||
def send(self, str):
|
def send(self, data):
|
||||||
"""Send `str' to the server."""
|
"""Send `data' to the server."""
|
||||||
if self.sock is None:
|
if self.sock is None:
|
||||||
if self.auto_open:
|
if self.auto_open:
|
||||||
self.connect()
|
self.connect()
|
||||||
|
|
@ -738,14 +738,14 @@ class HTTPConnection:
|
||||||
# NOTE: we DO propagate the error, though, because we cannot simply
|
# NOTE: we DO propagate the error, though, because we cannot simply
|
||||||
# ignore the error... the caller will know if they can retry.
|
# ignore the error... the caller will know if they can retry.
|
||||||
if self.debuglevel > 0:
|
if self.debuglevel > 0:
|
||||||
print("send:", repr(str))
|
print("send:", repr(data))
|
||||||
blocksize = 8192
|
blocksize = 8192
|
||||||
if hasattr(str, "read") :
|
if hasattr(data, "read") :
|
||||||
if self.debuglevel > 0:
|
if self.debuglevel > 0:
|
||||||
print("sendIng a read()able")
|
print("sendIng a read()able")
|
||||||
encode = False
|
encode = False
|
||||||
try:
|
try:
|
||||||
mode = str.mode
|
mode = data.mode
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# io.BytesIO and other file-like objects don't have a `mode`
|
# io.BytesIO and other file-like objects don't have a `mode`
|
||||||
# attribute.
|
# attribute.
|
||||||
|
|
@ -756,14 +756,14 @@ class HTTPConnection:
|
||||||
if self.debuglevel > 0:
|
if self.debuglevel > 0:
|
||||||
print("encoding file using iso-8859-1")
|
print("encoding file using iso-8859-1")
|
||||||
while 1:
|
while 1:
|
||||||
data = str.read(blocksize)
|
datablock = data.read(blocksize)
|
||||||
if not data:
|
if not datablock:
|
||||||
break
|
break
|
||||||
if encode:
|
if encode:
|
||||||
data = data.encode("iso-8859-1")
|
datablock = datablock.encode("iso-8859-1")
|
||||||
self.sock.sendall(data)
|
self.sock.sendall(datablock)
|
||||||
else:
|
else:
|
||||||
self.sock.sendall(str)
|
self.sock.sendall(data)
|
||||||
|
|
||||||
def _output(self, s):
|
def _output(self, s):
|
||||||
"""Add a line of output to the current request buffer.
|
"""Add a line of output to the current request buffer.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue