~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/_urllib.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-11-04 18:51:39 UTC
  • mfrom: (2961.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20071104185139-kaio3sneodg2kp71
Authentication ring implementation (read-only)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from bzrlib.transport.http._urllib2_wrappers import (
30
30
    Opener,
31
31
    Request,
32
 
    extract_authentication_uri,
33
 
    extract_credentials,
34
32
    )
35
33
 
36
34
 
57
55
        path = self._combine_paths(self._path, relative)
58
56
        # urllib2 will be confused if it find authentication
59
57
        # info (user, password) in the urls. So we handle them separatly.
 
58
 
 
59
        # rhaaaa ! confused where ? confused when ? --vila 20070922
60
60
        return self._unsplit_url(self._unqualified_scheme,
61
61
                                 None, None, self._host, self._port, path)
62
62
 
71
71
            request.connection = connection
72
72
            (auth, proxy_auth) = self._get_credentials()
73
73
        else:
74
 
            # First request, intialize credentials
 
74
            # First request, intialize credentials.
 
75
            # scheme and realm will be set by the _urllib2_wrappers.AuthHandler
75
76
            user = self._user
76
77
            password = self._password
77
 
            authuri = self._remote_path('.')
78
 
            auth = {'user': user, 'password': password, 'authuri': authuri}
79
 
 
80
 
            if user and password is not None: # '' is a valid password
81
 
                # Make the (user, password) available to urllib2
82
 
                # We default to a realm of None to catch them all.
83
 
                self._opener.password_manager.add_password(None, authuri,
84
 
                                                           user, password)
85
 
            proxy_auth = {}
 
78
            auth = dict(host=self._host, port=self._port,
 
79
                        user=user, password=password,
 
80
                        protocol=self._unqualified_scheme,
 
81
                        path=self._path)
 
82
            # Proxy initialization will be done by first proxied request
 
83
            proxy_auth = dict()
86
84
        # Ensure authentication info is provided
87
85
        request.auth = auth
88
86
        request.proxy_auth = proxy_auth