[issue13642] urllib incorrectly quotes username and password in https basic auth

Senthil Kumaran report at bugs.python.org
Fri Jan 6 11:53:51 CET 2012


Senthil Kumaran <senthil at uthcode.com> added the comment:

Some review comments. Instead of doing the inline unquote like this -

-            auth = base64.b64encode(user_passwd).strip()
+            auth = base64.b64encode(unquote(user_passwd)).strip()

It is better to do the explicitly above the b64 encoding step.
Just as host has been unquoted.

                    user_passwd, host = splituser(host)
                    host = unquote(host)

Also, you have done this only for https_open, the same would need be replicated for http_open and also for proxy_passwd.  Also on tests, Modifying sendall with

             def sendall(self, str):
-                pass
+                FakeHTTPConnection.request += str

seems a bit odd to me, you are using a class level object and adding a str. I think, there should be better way to do. (I shall provide an example). Also str term can replaced, even if it was coming from old code.

----------
assignee:  -> orsenthil
stage:  -> patch review

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13642>
_______________________________________


More information about the Python-bugs-list mailing list