mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-16 22:10:26 +00:00
Fix joining of URLs when parent URL has CGI parameter.
This commit is contained in:
parent
2963a5bf47
commit
4a0c63aa56
3 changed files with 17 additions and 1 deletions
|
|
@ -1,3 +1,9 @@
|
|||
6.4 "" (released xx.xx.2011)
|
||||
|
||||
Fixes:
|
||||
- checking: Do not remove CGI parameters when joining URLs.
|
||||
|
||||
|
||||
6.3 "Due Date" (released 6.2.2011)
|
||||
|
||||
Fixes:
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ class UrlBase (object):
|
|||
elif self.parent_url:
|
||||
# strip the parent url query and anchor
|
||||
urlparts = list(urlparse.urlsplit(self.parent_url))
|
||||
urlparts[3] = urlparts[4] = ""
|
||||
urlparts[4] = ""
|
||||
parent_url = urlparse.urlunsplit(urlparts)
|
||||
self.url = urljoin(parent_url, base_url, self.scheme)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -55,3 +55,13 @@ class TestUrlBuild (unittest.TestCase):
|
|||
scheme = 'http'
|
||||
res = linkcheck.checker.urlbase.urljoin(parent_url, base_url, scheme)
|
||||
self.assertEqual(res, 'http://localhost:8001/;param=value')
|
||||
|
||||
def test_http_build2 (self):
|
||||
parent_url = u'http://www.ngdc.noaa.gov/nndc/struts/results?nd=suppress&eq_0=8&t=101365&s=4&d=3&d=5&d=6'
|
||||
base_url = u'#nesdis'
|
||||
recursion_level = 0
|
||||
aggregate = get_test_aggregate()
|
||||
o = linkcheck.checker.httpurl.HttpUrl(base_url, recursion_level,
|
||||
aggregate, parent_url=parent_url)
|
||||
o.build_url()
|
||||
self.assertEqual(o.url, parent_url+base_url)
|
||||
|
|
|
|||
Loading…
Reference in a new issue