Skip to content

Commit

Permalink
Update connection.py
Browse files Browse the repository at this point in the history
We had the same issue as report in ticket boto#2869.

These are the problems that this update fixes:
* Socket.sendall requires bytes as input and not strings.
* HTTPResponse no longer supports the "strict" parameter.
  • Loading branch information
tiznull committed Jan 16, 2015
1 parent 873e89c commit 22c1d7b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions boto/connection.py
Expand Up @@ -793,18 +793,18 @@ def proxy_ssl(self, host=None, port=None):
else:
sock = socket.create_connection((self.proxy, int(self.proxy_port)))
boto.log.debug("Proxy connection: CONNECT %s HTTP/1.0\r\n", host)
sock.sendall("CONNECT %s HTTP/1.0\r\n" % host)
sock.sendall("User-Agent: %s\r\n" % UserAgent)
sock.sendall(bytes(("CONNECT %s HTTP/1.0\r\n" % host), "utf-8"))
sock.sendall(bytes(("User-Agent: %s\r\n" % UserAgent), "utf-8"))
if self.proxy_user and self.proxy_pass:
for k, v in self.get_proxy_auth_header().items():
sock.sendall("%s: %s\r\n" % (k, v))
sock.sendall(bytes("%s: %s\r\n" % (k, v), "utf-8"))
# See discussion about this config option at
# https://groups.google.com/forum/?fromgroups#!topic/boto-dev/teenFvOq2Cc
if config.getbool('Boto', 'send_crlf_after_proxy_auth_headers', False):
sock.sendall("\r\n")
sock.sendall(bytes("\r\n", "utf-8"))
else:
sock.sendall("\r\n")
resp = http_client.HTTPResponse(sock, strict=True, debuglevel=self.debug)
sock.sendall(bytes("\r\n", "utf-8"))
resp = http_client.HTTPResponse(sock, debuglevel=self.debug)
resp.begin()

if resp.status != 200:
Expand Down Expand Up @@ -1224,3 +1224,4 @@ def get_status(self, action, params, path='/', parent=None, verb='GET'):
boto.log.error('%s %s' % (response.status, response.reason))
boto.log.error('%s' % body)
raise self.ResponseError(response.status, response.reason, body)

0 comments on commit 22c1d7b

Please sign in to comment.