From 2473bdb77aa850f58d67b4f8ad16fdd2c5071d7a Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Mon, 23 Feb 2015 23:37:04 -0800 Subject: [PATCH] Fix default port for HTTPS. --- tests/unit/test_request.py | 4 ++-- vcr/migration.py | 2 +- vcr/request.py | 2 +- vcr/stubs/__init__.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/test_request.py b/tests/unit/test_request.py index 28b695d..9a26acc 100644 --- a/tests/unit/test_request.py +++ b/tests/unit/test_request.py @@ -21,8 +21,8 @@ def test_headers(): ('http://go.com/', 80), ('http://go.com:80/', 80), ('http://go.com:3000/', 3000), - ('https://go.com/', 433), - ('https://go.com:433/', 433), + ('https://go.com/', 443), + ('https://go.com:443/', 443), ('https://go.com:3000/', 3000), ]) def test_port(uri, expected_port): diff --git a/vcr/migration.py b/vcr/migration.py index fb3f317..9e423f8 100644 --- a/vcr/migration.py +++ b/vcr/migration.py @@ -58,7 +58,7 @@ PARTS = [ def build_uri(**parts): port = parts['port'] scheme = parts['protocol'] - default_port = {'https': 433, 'http': 80}[scheme] + default_port = {'https': 443, 'http': 80}[scheme] parts['port'] = ':{0}'.format(port) if port != default_port else '' return "{protocol}://{host}{port}{path}".format(**parts) diff --git a/vcr/request.py b/vcr/request.py index 30c052d..0525732 100644 --- a/vcr/request.py +++ b/vcr/request.py @@ -51,7 +51,7 @@ class Request(object): parse_uri = urlparse(self.uri) port = parse_uri.port if port is None: - port = {'https': 433, 'http': 80}[parse_uri.scheme] + port = {'https': 443, 'http': 80}[parse_uri.scheme] return port @property diff --git a/vcr/stubs/__init__.py b/vcr/stubs/__init__.py index bad8a83..c4f10d6 100644 --- a/vcr/stubs/__init__.py +++ b/vcr/stubs/__init__.py @@ -128,7 +128,7 @@ class VCRConnection(object): Returns empty string for the default port and ':port' otherwise """ port = self.real_connection.port - default_port = {'https': 433, 'http': 80}[self._protocol] + default_port = {'https': 443, 'http': 80}[self._protocol] return ':{0}'.format(port) if port != default_port else '' def _uri(self, url):