| https://github.com/boto/boto/commit/b9f6cb0ab717ea76e2780c7fddd1cd36b3bf7d63 |
| |
| From b9f6cb0ab717ea76e2780c7fddd1cd36b3bf7d63 Mon Sep 17 00:00:00 2001 |
| From: Matt Houglum <houglum@google.com> |
| Date: Fri, 21 Jun 2019 15:09:11 -0700 |
| Subject: [PATCH] Make server_name() behave correctly for PY3 |
| |
| ...because Python-2.6-or-newer doesn't just include Python 2.6 and 2.7. |
| --- |
| boto/connection.py | 14 +++++--------- |
| 1 file changed, 5 insertions(+), 9 deletions(-) |
| |
| diff --git a/boto/connection.py b/boto/connection.py |
| index 54e26fb2de16..bbb25d8fb842 100644 |
| --- a/boto/connection.py |
| +++ b/boto/connection.py |
| @@ -650,17 +650,13 @@ class AWSAuthConnection(object): |
| if port == 80: |
| signature_host = self.host |
| else: |
| - # This unfortunate little hack can be attributed to |
| - # a difference in the 2.6 version of http_client. In old |
| - # versions, it would append ":443" to the hostname sent |
| - # in the Host header and so we needed to make sure we |
| - # did the same when calculating the V2 signature. In 2.6 |
| - # (and higher!) |
| - # it no longer does that. Hence, this kludge. |
| - if ((ON_APP_ENGINE and sys.version[:3] == '2.5') or |
| - sys.version[:3] in ('2.6', '2.7')) and port == 443: |
| + ver_int = sys.version_info[0] * 10 + sys.version_info[1] |
| + if port == 443 and ver_int >= 26: # Py >= 2.6 |
| signature_host = self.host |
| else: |
| + # In versions < 2.6, Python's http_client would append ":443" |
| + # to the hostname sent in the Host header and so we needed to |
| + # make sure we did the same when calculating the V2 signature. |
| signature_host = '%s:%d' % (self.host, port) |
| return signature_host |
| |
| -- |
| 2.28.0 |
| |