/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2007-03-05 03:43:56 UTC
  • mfrom: (2312 +trunk)
  • mto: (2255.11.6 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070305034356-og43j35eg62m952f
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
import os
27
27
from cStringIO import StringIO
 
28
import sys
28
29
 
29
30
from bzrlib import (
30
31
    errors,
37
38
from bzrlib.trace import mutter
38
39
from bzrlib.transport import register_urlparse_netloc_protocol
39
40
from bzrlib.transport.http import (
 
41
    ca_bundle,
40
42
    _extract_headers,
41
43
    HttpTransportBase,
42
44
    _pycurl_errors,
79
81
 
80
82
    def __init__(self, base, from_transport=None):
81
83
        super(PyCurlTransport, self).__init__(base)
 
84
        if base.startswith('https'):
 
85
            # Check availability of https into pycurl supported
 
86
            # protocols
 
87
            supported = pycurl.version_info()[8]
 
88
            if 'https' not in supported:
 
89
                raise DependencyNotPresent('pycurl', 'no https support')
 
90
        self.cabundle = ca_bundle.get_ca_path()
82
91
        if from_transport is not None:
83
92
            self._curl = from_transport._curl
84
93
        else:
230
239
        ua_str = 'bzr/%s (pycurl)' % (bzrlib.__version__,)
231
240
        curl.setopt(pycurl.USERAGENT, ua_str)
232
241
        curl.setopt(pycurl.FOLLOWLOCATION, 1) # follow redirect responses
 
242
        if self.cabundle:
 
243
            curl.setopt(pycurl.CAINFO, self.cabundle)
233
244
 
234
245
    def _curl_perform(self, curl, more_headers=[]):
235
246
        """Perform curl operation and translate exceptions."""