cp-ticket-1386.patch revision 5945
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson# This issue has been offered to upstream and merged.
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson# Please see https://bitbucket.org/cherrypy/cherrypy/commits/89dbd2f00b541f8f8378eaabf2caef3e932bb805
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson# HG changeset patch
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson# User Yiteng Zhang <yiteng.zhang@oracle.com>
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson# Date 1461887965 25200
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson# Node ID 89dbd2f00b541f8f8378eaabf2caef3e932bb805
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson# Parent ea07b29deabd28d5a10b764a1a452c876692d028
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilsonparse_request_uri() incorrectly parses URI which contains ://
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson--- cherrypy/wsgiserver/wsgiserver2.py
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson+++ cherrypy/wsgiserver/wsgiserver2.py
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson@@ -92,6 +92,7 @@
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson import traceback as traceback_
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson import operator
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson from urllib import unquote
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson+from urlparse import urlparse
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson import warnings
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson import errno
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson import logging
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson@@ -830,15 +831,12 @@
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson if uri == ASTERISK:
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson return None, None, uri
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson- i = uri.find('://')
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson- if i > 0 and QUESTION_MARK not in uri[:i]:
65e99be301d5a19db33f25841f671756e8dbb9b5ludovicp+ scheme, authority, path, params, query, fragment = urlparse(uri)
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson+ if scheme and QUESTION_MARK not in scheme:
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson # An absoluteURI.
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson # If there's a scheme (and it must be http or https), then:
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson # http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson # ]]
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson- scheme, remainder = uri[:i].lower(), uri[i + 3:]
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara- authority, path = remainder.split(FORWARD_SLASH, 1)
27f8adec83293fb8bd3bfa37175322b0ee3bb933jvergara- path = FORWARD_SLASH + path
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson return scheme, authority, path
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson
49050c663d9aaca6919a5a77cd739ea9ddcd9e03neil_a_wilson if uri.startswith(FORWARD_SLASH):
--- cherrypy/wsgiserver/wsgiserver3.py
+++ cherrypy/wsgiserver/wsgiserver3.py
@@ -92,6 +92,8 @@
import traceback as traceback_
import errno
import logging
+from urllib.parse import urlparse
+
try:
# prefer slower Python-based io module
import _pyio as io
@@ -819,14 +821,13 @@
if uri == ASTERISK:
return None, None, uri
- scheme, sep, remainder = uri.partition(b'://')
- if sep and QUESTION_MARK not in scheme:
+ scheme, authority, path, params, query, fragment = urlparse(uri)
+ if scheme and QUESTION_MARK not in scheme:
# An absoluteURI.
# If there's a scheme (and it must be http or https), then:
# http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query
# ]]
- authority, path_a, path_b = remainder.partition(FORWARD_SLASH)
- return scheme.lower(), authority, path_a + path_b
+ return scheme, authority, path
if uri.startswith(FORWARD_SLASH):
# An abs_path.