~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-22 16:32: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-20070422163204-7iksk91jy9091nex
Handle nonce changes. Fix a nasty bug breaking the auth parameters sharing.

* bzrlib/tests/HTTPTestUtil.py:
(DigestAuthServer.digest_authorized): Check the nonce validity.

* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib._perform): Always update auth parameters
after a request processing, they could change at any moment.

* bzrlib/transport/http/_urllib2_wrappers.py:
(AbstractAuthHandler.update_auth): New method to track auth
modifications that should be lead to new authentications.
(AbstractAuthHandler.auth_required): Do not copy the auth
parameters but track the changes instead (copying breaks the auth
parameters sharing between cloned transports). Do not restrict the
auth 'identity' to be (user, realm, password) only.
(AbstractAuthHandler.auth_match): Document the auth parameter
update policy that MUST be respected to avoid retrying to
authenticate with wrong parameters, endlessly.
(AbstractAuthHandler.auth_successful): Not used anymore, but kept
in place if we ever want to handle the 'Authorization-Info' header.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
        if self._debuglevel > 0:
91
91
            print 'perform: %s base: %s, url: %s' % (request.method, self.base,
92
92
                                                     request.get_full_url())
93
 
 
94
93
        response = self._opener.open(request)
95
94
        if self._connection is None:
96
95
            # Acquire connection when the first request is able
97
96
            # to connect to the server
98
97
            self._connection = request.connection
99
 
            # And get auth parameters too
100
 
            self._auth = request.auth
101
 
            self._proxy_auth = request.proxy_auth
 
98
        # Always get auth parameters, they may change
 
99
        self._auth = request.auth
 
100
        self._proxy_auth = request.proxy_auth
102
101
 
103
102
        code = response.code
104
103
        if request.follow_redirections is False \