Bug 1787227

Summary: python3-urllib3 1.25.1 fails to parse URLs with brackets
Product: [Fedora] Fedora EPEL Reporter: Ewoud Kohl van Wijngaarden <ekohlvan>
Component: python3-urllib3Assignee: Orion Poplawski <orion>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: orion, TicoTimo
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python3-urllib3-1.25.6-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-24 01:05:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ewoud Kohl van Wijngaarden 2020-01-01 18:20:36 UTC
Description of problem:

When performing a request to a URL with a special character, it fails to parse.


Version-Release number of selected component (if applicable):

python36-urllib3 1.25.1-1.el7


How reproducible:

Always.


Steps to Reproduce:
1. Install python36-urllib3 1.25.1-1.el7
2. python3 -c "import requests ; requests.get('http://example.com/api/json?tree=jobs[x]')"


Actual results:

# python3 -c "import requests ; requests.get('http://example.com/api/json?tree=jobs[x]')"
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 374, in prepare_url
    scheme, auth, host, port, path, query, fragment = parse_url(url)
  File "/usr/lib/python3.6/site-packages/requests/packages/urllib3/util/url.py", line 212, in parse_url
    six.raise_from(LocationParseError(url), None)
  File "<string>", line 3, in raise_from
requests.packages.urllib3.exceptions.LocationParseError: Failed to parse: http://example.com/api/json?tree=jobs[x]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 516, in request
    prep = self.prepare_request(req)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 448, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 302, in prepare
    self.prepare_url(url, params)
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 376, in prepare_url
    raise InvalidURL(*e.args)
requests.exceptions.InvalidURL: Failed to parse: http://example.com/api/json?tree=jobs[x]


Expected results:

Valid request


Additional info:

Upstream this is fixed in https://github.com/urllib3/urllib3/pull/1586 and part of 1.25.2. Manually applying the patch fixes the issue.

Comment 1 Fedora Update System 2020-02-08 21:53:55 UTC
FEDORA-EPEL-2020-7894ebebfb has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-7894ebebfb

Comment 2 Fedora Update System 2020-02-09 01:48:10 UTC
python3-six-1.12.0-1.el7, python3-urllib3-1.25.6-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-7894ebebfb

Comment 3 Fedora Update System 2020-02-24 01:05:00 UTC
python3-six-1.12.0-1.el7, python3-urllib3-1.25.6-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.