-
Committer:
Vincent Ladeuil
-
Date:
2007-04-19 17:28:04 UTC
-
mto:
(2420.1.21 bzr.http.auth)
-
mto:
This revision was merged to the branch mainline in
revision
2463.
-
Revision ID:
v.ladeuil+lp@free.fr-20070419172804-m3b5ayyfslh08vrr
Refactor http and proxy authentication. Tests passing. proxy password can be prompted too.
* bzrlib/transport/http/_urllib2_wrappers.py:
(Request.__init__): New auth and proxy_auth attributes: tuples
with all the needed info). Should accept digest auth too.
(extract_authentication_uri): New function. Clearly define how we
define authentication uri for bzr.
(ProxyHandler.set_proxy): As HttpTransport_urllib.__init__,
extract auth info from env variables and leave the auth handlers
do the job.
(AbstractAuthHandler): Better abstraction of authentication,
handles auth errors and preventively set headers once the first
auth is successful.
(AbstractBasicAuthHandler): Specialization for basic scheme
authentication.
(HTTPBasicAuthHandler, ProxyBasicAuthHandler): Simplified, do not
rely on urllib2 anymore.
* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib.__init__): Use a tuple instead of different
attributes for scheme, user, password as we need two more
attributes (authuri and realm) for each auth (http and
proxy). And, yes, better handling of proxies (including prompting
user for a password).
(HttpTransport_urllib._ask_password): Deleted. _urllib2_wrappers
is handling that now.
* bzrlib/tests/test_http.py:
(TestHTTPBasicAuth.get_user_transport, TestHTTPProxyBasicAuth):
New method to build a different transport when proxying or not.