84 @type str |
78 @type str |
85 @return quoted string |
79 @return quoted string |
86 @rtype str |
80 @rtype str |
87 """ |
81 """ |
88 safeChars = '!"$&\'()*+,-./:;<=>?@[\\]^_`{|}~' |
82 safeChars = '!"$&\'()*+,-./:;<=>?@[\\]^_`{|}~' |
89 return urllib.quote(s, safe=safeChars) |
83 return urllib.parse.quote(s, safe=safeChars) |
90 |
84 |
91 url = self.__url.strip() |
85 url = self.__url.strip() |
92 url = url.replace('\n', '').replace('\r', '').replace('\t', '') |
86 url = url.replace('\n', '').replace('\r', '').replace('\t', '') |
93 url = url.split('#', 1)[0] |
87 url = url.split('#', 1)[0] |
94 if url.startswith('//'): |
88 if url.startswith('//'): |
95 url = Preferences.getWebBrowser("DefaultScheme")[:-3] + url |
89 url = Preferences.getWebBrowser("DefaultScheme")[:-3] + url |
96 if len(url.split('://')) <= 1: |
90 if len(url.split('://')) <= 1: |
97 url = Preferences.getWebBrowser("DefaultScheme") + url |
91 url = Preferences.getWebBrowser("DefaultScheme") + url |
98 url = quote(fullUnescape(url)) |
92 url = quote(fullUnescape(url)) |
99 urlParts = urlparse.urlsplit(url) |
93 urlParts = urllib.parse.parse.urlsplit(url) |
100 if not urlParts[0]: |
94 if not urlParts[0]: |
101 url = Preferences.getWebBrowser("DefaultScheme") + url |
95 url = Preferences.getWebBrowser("DefaultScheme") + url |
102 urlParts = urlparse.urlsplit(url) |
96 urlParts = urllib.parse.parse.urlsplit(url) |
103 protocol = urlParts.scheme |
97 protocol = urlParts.scheme |
104 host = fullUnescape(urlParts.hostname) |
98 host = fullUnescape(urlParts.hostname) |
105 path = fullUnescape(urlParts.path) |
99 path = fullUnescape(urlParts.path) |
106 query = urlParts.query |
100 query = urlParts.query |
107 if not query and '?' not in url: |
101 if not query and '?' not in url: |
182 curPath = '' |
176 curPath = '' |
183 for i in range(min(4, len(pathParts))): |
177 for i in range(min(4, len(pathParts))): |
184 curPath = curPath + pathParts[i] + '/' |
178 curPath = curPath + pathParts[i] + '/' |
185 yield curPath |
179 yield curPath |
186 |
180 |
187 protocol, addressStr = urllib.splittype(url) |
181 protocol, addressStr = urllib.parse.splittype(url) |
188 host, path = urllib.splithost(addressStr) |
182 host, path = urllib.parse.splithost(addressStr) |
189 user, host = urllib.splituser(host) |
183 user, host = urllib.parse.splituser(host) |
190 host, port = urllib.splitport(host) |
184 host, port = urllib.parse.splitport(host) |
191 host = host.strip('/') |
185 host = host.strip('/') |
192 seenPermutations = set() |
186 seenPermutations = set() |
193 for h in hostPermutations(host): |
187 for h in hostPermutations(host): |
194 for p in pathPermutations(path): |
188 for p in pathPermutations(path): |
195 u = '{0}{1}'.format(h, p) |
189 u = '{0}{1}'.format(h, p) |