106 query = urlParts.query |
106 query = urlParts.query |
107 if not query and '?' not in url: |
107 if not query and '?' not in url: |
108 query = None |
108 query = None |
109 if not path: |
109 if not path: |
110 path = '/' |
110 path = '/' |
111 hasTrailingSlash = (path[-1] == '/') |
|
112 path = posixpath.normpath(path).replace('//', '/') |
111 path = posixpath.normpath(path).replace('//', '/') |
113 if hasTrailingSlash and path[-1] != '/': |
112 if path[-1] != '/': |
114 path += '/' |
113 path += '/' |
115 port = urlParts.port |
114 port = urlParts.port |
116 host = host.strip('.') |
115 host = host.strip('.') |
117 host = re.sub(r'\.+', '.', host).lower() |
116 host = re.sub(r'\.+', '.', host).lower() |
118 if host.isdigit(): |
117 if host.isdigit(): |