cgi param fix

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1850 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2004-09-25 12:18:58 +00:00
parent 81c0fa70c1
commit 8a539c782a

View file

@ -145,12 +145,16 @@ def parse_qsl (qs, keep_blank_values=0, strict_parsing=0):
if strict_parsing:
raise ValueError, "bad query field: %s" % `name_value`
elif len(nv) == 1:
nv = (nv[0], "")
# None value indicates missing equal sign
nv = (nv[0], None)
else:
continue
if len(nv[1]) or keep_blank_values:
if nv[1] or keep_blank_values:
name = urllib.unquote(nv[0].replace('+', ' '))
value = urllib.unquote(nv[1].replace('+', ' '))
if nv[1]:
value = urllib.unquote(nv[1].replace('+', ' '))
else:
value = nv[1]
r.append((name, value))
return r
@ -196,8 +200,11 @@ def url_norm (url):
if v:
v = urllib.quote(v, '/-:,')
l.append("%s=%s" % (k, v))
else:
elif v is None:
l.append(k)
else:
# some sites do not work when the equal sign is missing
l.append("%s=" % k)
urlparts[3] = '&'.join(l)
if not urlparts[2]:
# empty path should be a slash, but not in certain schemes