bufferedhttp: ensure query params are properly quoted
Recent versions of py27 [1] have begun raising InvalidURL if you try to
include non-ASCII characters in the request path. This was observed
recently in the periodic checks of stable/ocata and stable/pike. In
particular, we would spin up some in-process servers in
test.unit.proxy.test_server.TestSocketObjectVersions and do a container
listing with a prefix param that included raw (unquoted) UTF-8. This
query string would pass unmolested through the proxy, tripping the
InvalidURL error when bufferedhttp called putrequest.
More recent versions of Swift would not exhibit this particular failure,
as the listing_formats middleware would force a decoding/re-encoding of
the query string for account and container requests. However, object
requests with errant query strings would likely be able to trip the same
error.
Swift on py3 should not exhibit this behavior, as we so
thoroughly re-write the request line to avoid hitting https://bugs.python.org/issue33973.
Now, always parse and re-encode the query string in bufferedhttp. This
prevents any errors on object requests and cleans up any callers that
might use bufferedhttp directly.
Reviewed: https:/ /review. opendev. org/682112 /git.openstack. org/cgit/ openstack/ swift/commit/ ?id=9cc6d413894 6034516fdf579ac 084cb954ea6b06
Committed: https:/
Submitter: Zuul
Branch: stable/stein
commit 9cc6d4138946034 516fdf579ac084c b954ea6b06
Author: Tim Burke <email address hidden>
Date: Thu Sep 12 10:59:08 2019 -0700
bufferedhttp: ensure query params are properly quoted
Recent versions of py27 [1] have begun raising InvalidURL if you try to unit.proxy. test_server. TestSocketObjec tVersions and do a container
include non-ASCII characters in the request path. This was observed
recently in the periodic checks of stable/ocata and stable/pike. In
particular, we would spin up some in-process servers in
test.
listing with a prefix param that included raw (unquoted) UTF-8. This
query string would pass unmolested through the proxy, tripping the
InvalidURL error when bufferedhttp called putrequest.
More recent versions of Swift would not exhibit this particular failure, re-encoding of
as the listing_formats middleware would force a decoding/
the query string for account and container requests. However, object
requests with errant query strings would likely be able to trip the same
error.
Swift on py3 should not exhibit this behavior, as we so /bugs.python. org/issue33973.
thoroughly re-write the request line to avoid hitting
https:/
Now, always parse and re-encode the query string in bufferedhttp. This
prevents any errors on object requests and cleans up any callers that
might use bufferedhttp directly.
[1] Anything after https:/ /github. com/python/ cpython/ commit/ bb8071a; /bugs.python. org/issue30458
see https:/
Closes-Bug: 1843816 fc5d3cb89035587 1c26ed271a6 d8dd5784ce329d7 cb4fbaf700d f3b620fb196fa56 7ce7575d522 33e9b5bfbcaafa4 b45b592d34)
Change-Id: I73f84b96f164e6
Related-Change: Id3ce37aa0402e2
Related-Change: Ie648f5c04d4415
(cherry picked from commit 49f62f6ab7fd1b8