~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2007-04-03 13:00:39 UTC
  • mto: (2420.1.1 bzr.http.auth)
  • mto: This revision was merged to the branch mainline in revision 2463.
  • Revision ID: v.ladeuil+lp@free.fr-20070403130039-5yuvjob1hwqjkvsd
Partial fix for bug #72292.

* bzrlib/transport/http/_urllib.py: 
(HttpTransport_urllib.ask_password): If a password is already
supplied, pass it to the password manager.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
        """Ask for a password if none is already provided in the request"""
60
60
        # TODO: jam 20060915 There should be a test that asserts we ask 
61
61
        #       for a password at the right time.
 
62
        host = request.get_host()
 
63
        password_manager = self._opener.password_manager
62
64
        if request.password is None:
63
65
            # We can't predict realm, let's try None, we'll get a
64
66
            # 401 if we are wrong anyway
65
67
            realm = None
66
 
            host = request.get_host()
67
 
            password_manager = self._opener.password_manager
68
68
            # Query the password manager first
69
69
            user, password = password_manager.find_user_password(None, host)
70
70
            if user == request.user and password is not None:
75
75
                request.password = ui.ui_factory.get_password(prompt=http_pass,
76
76
                                                              user=request.user,
77
77
                                                              host=host)
78
 
                password_manager.add_password(None, host,
79
 
                                              request.user, request.password)
 
78
        password_manager.add_password(None, host,
 
79
                                      request.user, request.password)
80
80
 
81
81
    def _perform(self, request):
82
82
        """Send the request to the server and handles common errors.