diff --git a/debian/changelog b/debian/changelog index 221653c1117f7cb29011c1eff77b9374e91a0f22..8e63aa76efc1dabe621fdb09421f8e0d4cb67842 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-httpretty (0.9.5-3) UNRELEASED; urgency=medium + + [ Ben Finney ] + * Add a patch to correct upstream bug with matching URIs. + Closes: bug#919599. + + -- + python-httpretty (0.9.5-2) unstable; urgency=medium * Add RES_OPTIONS=attempts:0 to avoid resolving in unit tests. diff --git a/debian/patches/match-uri-without-hostname-case.patch b/debian/patches/match-uri-without-hostname-case.patch new file mode 100644 index 0000000000000000000000000000000000000000..95ae01069d9eabde50e96c34dbbf69bf8bb93c08 --- /dev/null +++ b/debian/patches/match-uri-without-hostname-case.patch @@ -0,0 +1,50 @@ +Description: Match URI without letter case in hostname. + The URI matching should ignore the hostname letter case, so that + intermediate “normalising” of the hostname does not affect whether + the URI matches. +Bug: https://github.com/gabrielfalcao/HTTPretty/issues/369 +Bug-Debian: http://bugs.debian.org/919599 +Author: Ben Finney +Forwarded: https://github.com/gabrielfalcao/HTTPretty/issues/369#issuecomment-455744083 +Last-Update: 2019-01-19 + +diff --git a/tests/unit/test_httpretty.py b/tests/unit/test_httpretty.py +--- a/tests/unit/test_httpretty.py ++++ b/tests/unit/test_httpretty.py +@@ -450,1 +450,23 @@ def test_socktype_good_python_version(): + HTTPretty.disable() ++ ++ ++def test_match_http_address_should_ignore_hostname_case(): ++ "HTTPretty.match_http_address should ignore case of hostname." ++ ++ for (register_hostname, match_hostname) in [ ++ ('foo.example.com', 'foo.example.com'), ++ ('FOO.example.COM', 'foo.example.com'), ++ ('foo.EXAMPLE.com', 'foo.example.com'), ++ ('fOo.eXaMpLe.com', 'foo.example.com'), ++ ('foo.example.com', 'FOO.example.COM'), ++ ('foo.example.com', 'foo.EXAMPLE.com'), ++ ('foo.example.com', 'fOo.eXaMpLe.com'), ++ ]: ++ HTTPretty.register_uri( ++ HTTPretty.GET, ++ "http://{hostname}/".format(hostname=register_hostname), ++ body="yay", ++ ) ++ assert HTTPretty.match_http_address(match_hostname, 80) ++ ++ + +diff --git a/httpretty/core.py b/httpretty/core.py +--- a/httpretty/core.py ++++ b/httpretty/core.py +@@ -1085,7 +1085,7 @@ class httpretty(HttpBaseClass): + or matcher.regex.pattern.startswith(pattern): + return matcher + +- elif matcher.info.hostname == hostname: ++ elif (matcher.info.hostname.lower() == hostname.lower()): + return matcher + return None + diff --git a/debian/patches/series b/debian/patches/series index 14929dde0c31019ce33864600c7d2f6bd1b92707..e5ed69b54487517c24c1f0ec68f4ed3506db7e97 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ remove-with-randomly.patch remove-broken-test.patch remove-network-access-test.patch +match-uri-without-hostname-case.patch