Kaydet (Commit) 6b3026ce authored tarafından Senthil Kumaran's avatar Senthil Kumaran

merge from 3.3

#17403: urllib.parse.robotparser normalizes the urls before adding to
ruleline. This helps in handling certain types invalid urls in a conservative
manner. Patch contributed by Mher Movsisyan.
...@@ -234,6 +234,18 @@ bad = ['/some/path'] ...@@ -234,6 +234,18 @@ bad = ['/some/path']
RobotTest(15, doc, good, bad) RobotTest(15, doc, good, bad)
# 16. Empty query (issue #17403). Normalizing the url first.
doc = """
User-agent: *
Allow: /some/path?
Disallow: /another/path?
"""
good = ['/some/path?']
bad = ['/another/path?']
RobotTest(16, doc, good, bad)
class NetworkTestCase(unittest.TestCase): class NetworkTestCase(unittest.TestCase):
......
...@@ -157,6 +157,7 @@ class RuleLine: ...@@ -157,6 +157,7 @@ class RuleLine:
if path == '' and not allowance: if path == '' and not allowance:
# an empty value means allow all # an empty value means allow all
allowance = True allowance = True
path = urllib.parse.urlunparse(urllib.parse.urlparse(path))
self.path = urllib.parse.quote(path) self.path = urllib.parse.quote(path)
self.allowance = allowance self.allowance = allowance
......
...@@ -96,6 +96,10 @@ Core and Builtins ...@@ -96,6 +96,10 @@ Core and Builtins
Library Library
------- -------
- Issue #17403: urllib.parse.robotparser normalizes the urls before adding to
ruleline. This helps in handling certain types invalid urls in a conservative
manner. Patch contributed by Mher Movsisyan.
- Issue #18070: Have importlib.util.module_for_loader() set attributes - Issue #18070: Have importlib.util.module_for_loader() set attributes
unconditionally in order to properly support reloading. unconditionally in order to properly support reloading.
......
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