~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
    _opener_class = Opener
40
40
 
41
 
    def __init__(self, base, _from_transport=None):
 
41
    def __init__(self, base, _from_transport=None, ca_certs=None):
42
42
        super(HttpTransport_urllib, self).__init__(
43
43
            base, 'urllib', _from_transport=_from_transport)
44
44
        if _from_transport is not None:
45
45
            self._opener = _from_transport._opener
46
46
        else:
47
47
            self._opener = self._opener_class(
48
 
                report_activity=self._report_activity)
 
48
                report_activity=self._report_activity, ca_certs=ca_certs)
49
49
 
50
50
    def _perform(self, request):
51
51
        """Send the request to the server and handles common errors.
175
175
        )
176
176
    permutations = [(HttpTransport_urllib, http_server.HttpServer_urllib),]
177
177
    if features.HTTPSServerFeature.available():
178
 
        from bzrlib.tests import https_server
179
 
        permutations.append((HttpTransport_urllib,
 
178
        from bzrlib.tests import (
 
179
            https_server,
 
180
            ssl_certs,
 
181
            )
 
182
 
 
183
        class HTTPS_urllib_transport(HttpTransport_urllib):
 
184
 
 
185
            def __init__(self, base, _from_transport=None):
 
186
                super(HTTPS_urllib_transport, self).__init__(
 
187
                    base, _from_transport=_from_transport,
 
188
                    ca_certs=ssl_certs.build_path('ca.crt'))
 
189
 
 
190
        permutations.append((HTTPS_urllib_transport,
180
191
                             https_server.HTTPSServer_urllib))
181
192
    return permutations