Joonas Kuorilehto <jones...@derbian.fi> added the comment:

> 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)

Ok. So it needs to be done on the line after import base64.

> Also, you have done this only for https_open, the same would need be
> replicated for http_open and also for proxy_passwd.

So four cases where this may need to be fixed and my test only covers one of 
them:

* http without proxy
* http with proxy
* https without proxy
* https with proxy

Copypasted code :(

Can the https and the proxy auth be tested with the same fake http connection, 
when the request is stored?

>              def sendall(self, str):
> -                pass
> +                FakeHTTPConnection.request += str
> 
> seems a bit odd to me

Agreed, not clean and needs to be fixed. Works here, but could cause the test 
code to become unreadable later on. Wrote it at 5 am, not getting sleep. Please 
provide a cleaner alternative. :)

One question: how come the fake http is given HTTP headers in some tests and 
payload only in others? Is it emulating the TCP stream or the payload stream 
handle? It can't do both, can it? Are the headers in some tests actually doing 
anything?

I would not mind if someone else finished the patch :)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13642>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to