Kaydet (Commit) 452b0ce5 authored tarafından Senthil Kumaran's avatar Senthil Kumaran

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.
........
üst fca48efe
...@@ -752,8 +752,8 @@ class HTTPConnection: ...@@ -752,8 +752,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()
...@@ -761,16 +761,16 @@ class HTTPConnection: ...@@ -761,16 +761,16 @@ class HTTPConnection:
raise NotConnected() raise NotConnected()
if self.debuglevel > 0: if self.debuglevel > 0:
print "send:", repr(str) print "send:", repr(data)
blocksize = 8192 blocksize = 8192
if hasattr(str,'read') and not isinstance(str, array): if hasattr(data,'read') and not isinstance(data, array):
if self.debuglevel > 0: print "sendIng a read()able" if self.debuglevel > 0: print "sendIng a read()able"
data = str.read(blocksize) datablock = data.read(blocksize)
while data: while datablock:
self.sock.sendall(data) self.sock.sendall(datablock)
data = str.read(blocksize) datablock = data.read(blocksize)
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.
...@@ -842,9 +842,9 @@ class HTTPConnection: ...@@ -842,9 +842,9 @@ class HTTPConnection:
self._method = method self._method = method
if not url: if not url:
url = '/' url = '/'
str = '%s %s %s' % (method, url, self._http_vsn_str) hdr = '%s %s %s' % (method, url, self._http_vsn_str)
self._output(str) self._output(hdr)
if self._http_vsn == 11: if self._http_vsn == 11:
# Issue some standard headers for better HTTP/1.1 compliance # Issue some standard headers for better HTTP/1.1 compliance
...@@ -915,8 +915,8 @@ class HTTPConnection: ...@@ -915,8 +915,8 @@ class HTTPConnection:
if self.__state != _CS_REQ_STARTED: if self.__state != _CS_REQ_STARTED:
raise CannotSendHeader() raise CannotSendHeader()
str = '%s: %s' % (header, '\r\n\t'.join(values)) hdr = '%s: %s' % (header, '\r\n\t'.join(values))
self._output(str) self._output(hdr)
def endheaders(self, message_body=None): def endheaders(self, message_body=None):
"""Indicate that the last header line has been sent to the server. """Indicate that the last header line has been sent to the server.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment