~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2007-04-21 09:26:30 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-20070421092630-ty7a90wrx4v2x5k8
Refactor proxy and auth test classes. Tests failing for digest auth.

* bzrlib/transport/http/_urllib2_wrappers.py:
(AbstractAuthHandler.auth_required,
AbstractAuthHandler.auth_successful): Add response parameter as an
authentication scheme may need additional info provided only
there.

* bzrlib/tests/test_http.py:
(TestAuth, TestHTTPAuth, TestProxyAuth, TestHTTPBasicAuth,
TestHTTPProxyBasicAuth): Refactoring.
(TestHTTPDigestAuth, TestHTTPProxyDigestAuth): New classes for
digest authentication tests.

* bzrlib/tests/HttpServer.py:
(TestingHTTPRequestHandler.translate_path): Handles request
proxying based on a server attribute.
(HttpServer): Add proxy_requests attribute.

* bzrlib/tests/HTTPTestUtil.py:
(ProxyServer): Replaces FakeProxyRequestHandler now that
HttpServer handles proxying based on a server attribute.
(AuthRequestHandler, BasicAuthRequestHandler, AuthServer,
HTTPAuthServer, ProxyAuthServer, HTTPBasicAuthServer,
ProxyBasicAuthServer): Refactoring Auth servers and request
handlers.
(HTTPDigestAuthServer, ProxyDigestAuthServer): New classes for
digest authentication.

Show diffs side-by-side

added added

removed removed

Lines of Context:
792
792
            request.add_unredirected_header(self.auth_header, client_header)
793
793
            response = self.parent.open(request)
794
794
            if response:
795
 
                self.auth_successful(request, auth)
 
795
                self.auth_successful(request, response, auth)
796
796
            return response
797
797
        # We are not qualified to handle the authentication.
798
798
        # Note: the authentication error handling will try all
836
836
        """
837
837
        raise NotImplementedError(self.build_auth_header)
838
838
 
839
 
    def auth_successful(self, request, auth):
 
839
    def auth_successful(self, request, response, auth):
840
840
        """The authentification was successful for the request.
841
841
 
842
842
        The params are stored in the request to allow reuse and
843
843
        avoid rountrips associated with authentication errors.
844
844
 
845
845
        :param request: The succesfully authenticated request.
 
846
        :param response: The server response (may contain auth info).
846
847
        :param auth: The parameters used to succeed.
847
848
        """
848
849
        self.set_auth(request, auth)