Now normalizing the scheme in URIs
diff --git a/httplib2/__init__.py b/httplib2/__init__.py
index 81f9a6c..88cc05b 100644
--- a/httplib2/__init__.py
+++ b/httplib2/__init__.py
@@ -119,6 +119,7 @@
def urlnorm(uri):
(scheme, authority, path, query, fragment) = parse_uri(uri)
authority = authority.lower()
+ scheme = scheme.lower()
if not path:
path = "/"
# Could do syntax based normalization of the URI before
@@ -298,12 +299,6 @@
for key, value in response_headers.iteritems():
info[key] = value
text = info.as_string()
- #from cStringIO import StringIO
- #from email.Generator import Generator
- #fp = StringIO()
- #g = Generator(fp, mangle_from_=False, maxheaderlen=60)
- #g.flatten(info)
- #text = fp.getvalue()
text = re.sub("\r(?!\n)|(?<!\r)\n", "\r\n", text)
text += content
diff --git a/httplib2test.py b/httplib2test.py
index 216af63..61d7220 100755
--- a/httplib2test.py
+++ b/httplib2test.py
@@ -46,6 +46,7 @@
self.assertEqual( "http://example.org/?=b", httplib2.urlnorm("http://EXAMple.org?=b")[-1])
self.assertEqual( "http://example.org/mypath?a=b", httplib2.urlnorm("http://EXAMple.org/mypath?a=b")[-1])
self.assertEqual( "http://localhost:80/", httplib2.urlnorm("http://localhost:80")[-1])
+ self.assertEqual( httplib2.urlnorm("http://localhost:80/"), httplib2.urlnorm("HTTP://LOCALHOST:80"))
class UrlSafenameTest(unittest.TestCase):
def test(self):