summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert JW Regeer <bertjw@regeer.org>2019-08-27 14:24:28 -0600
committerBert JW Regeer <bertjw@regeer.org>2019-08-27 14:25:14 -0600
commite9a2de7eed8ebc4df0625de5b133860764987ce1 (patch)
treeb20aceabfd70192c0cb67ce74d5d760e63140f10
parent881fc2b4c329dc2db8c710a78cfdae0665268eef (diff)
downloadwaitress-e9a2de7eed8ebc4df0625de5b133860764987ce1.tar.gz
Add comment why this code exists
-rw-r--r--waitress/parser.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/waitress/parser.py b/waitress/parser.py
index c3b28e1..6ee700e 100644
--- a/waitress/parser.py
+++ b/waitress/parser.py
@@ -256,6 +256,13 @@ def split_uri(uri):
scheme = netloc = path = query = fragment = b''
+ # urlsplit below will treat this as a scheme-less netloc, thereby losing
+ # the original intent of the request. Here we shamelessly stole 4 lines of
+ # code from the CPython stdlib to parse out the fragment and query but
+ # leave the path alone. See
+ # https://github.com/python/cpython/blob/8c9e9b0cd5b24dfbf1424d1f253d02de80e8f5ef/Lib/urllib/parse.py#L465-L468
+ # and https://github.com/Pylons/waitress/issues/260
+
if uri[:2] == b'//':
path = uri