Open dailin opened 5 years ago
[I know this issue is old, but commenting because I found it when hitting the same error]
I hit this exception when the comma in the URL was not properly encoded. See https://www.w3schools.com/tags/ref_urlencode.asp for information about URL encoding. You can use urllib.urlencode in python to get a correctly encoded set of query parameters.
eg:
s = requests.Session()
s.mount('https://www.cloudflare.com/', HTTP20Adapter())
when url don't contain commas
r = s.get('https://www.cloudflare.com')
This is work well, but
r = s.get('https://www.cloudflare.com?data={a,b}')
Commas cause the following errors: File "/Library/Python/2.7/site-packages/hpack/hpack.py", line 249, in encode for header in headers: File "/Library/Python/2.7/site-packages/h2/utilities.py", line 474, in inner for header in headers: File "/Library/Python/2.7/site-packages/h2/utilities.py", line 419, in _validate_host_authority_header for header in headers: File "/Library/Python/2.7/site-packages/h2/utilities.py", line 331, in _reject_pseudo_header_fields "Received duplicate pseudo-header field %s" % header[0] h2.exceptions.ProtocolError: Received duplicate pseudo-header field :path
How can i fix it?