~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-01-23 19:08:05 UTC
  • mfrom: (6437.3.20 2.5)
  • mto: This revision was merged to the branch mainline in revision 6450.
  • Revision ID: jelmer@samba.org-20120123190805-hlcuihkt2dep44cw
merge bzr 2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
 
18
 
17
19
from bzrlib import (
18
20
    errors,
19
21
    trace,
36
38
 
37
39
    _opener_class = Opener
38
40
 
39
 
    def __init__(self, base, _from_transport=None):
 
41
    def __init__(self, base, _from_transport=None, ca_certs=None):
40
42
        super(HttpTransport_urllib, self).__init__(
41
43
            base, 'urllib', _from_transport=_from_transport)
42
44
        if _from_transport is not None:
43
45
            self._opener = _from_transport._opener
44
46
        else:
45
47
            self._opener = self._opener_class(
46
 
                report_activity=self._report_activity)
 
48
                report_activity=self._report_activity, ca_certs=ca_certs)
47
49
 
48
50
    def _perform(self, request):
49
51
        """Send the request to the server and handles common errors.
173
175
        )
174
176
    permutations = [(HttpTransport_urllib, http_server.HttpServer_urllib),]
175
177
    if features.HTTPSServerFeature.available():
176
 
        from bzrlib.tests import https_server
177
 
        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,
178
191
                             https_server.HTTPSServer_urllib))
179
192
    return permutations