~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Mark Hammond
  • Date: 2008-12-28 05:21:23 UTC
  • mfrom: (3920 +trunk)
  • mto: (3932.1.1 prepare-1.11)
  • mto: This revision was merged to the branch mainline in revision 3937.
  • Revision ID: mhammond@skippinet.com.au-20081228052123-f78xs5sbdkotshwf
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
def _get_transport_modules():
85
85
    """Return a list of the modules providing transports."""
86
86
    modules = set()
87
 
    for prefix, factory_list in transport_list_registry.iteritems():
 
87
    for prefix, factory_list in transport_list_registry.items():
88
88
        for factory in factory_list:
89
89
            if hasattr(factory, "_module_name"):
90
90
                modules.add(factory._module_name)
797
797
        cur = _CoalescedOffset(None, None, [])
798
798
        coalesced_offsets = []
799
799
 
 
800
        if max_size <= 0:
 
801
            # 'unlimited', but we actually take this to mean 100MB buffer limit
 
802
            max_size = 100*1024*1024
 
803
 
800
804
        for start, size in offsets:
801
805
            end = start + size
802
806
            if (last_end is not None
1245
1249
        # should be asked to ConnectedTransport only.
1246
1250
        return None
1247
1251
 
 
1252
    def _redirected_to(self, source, target):
 
1253
        """Returns a transport suitable to re-issue a redirected request.
 
1254
 
 
1255
        :param source: The source url as returned by the server.
 
1256
        :param target: The target url as returned by the server.
 
1257
 
 
1258
        The redirection can be handled only if the relpath involved is not
 
1259
        renamed by the redirection.
 
1260
 
 
1261
        :returns: A transport or None.
 
1262
        """
 
1263
        # This returns None by default, meaning the transport can't handle the
 
1264
        # redirection.
 
1265
        return None
 
1266
 
 
1267
 
1248
1268
 
1249
1269
class _SharedConnection(object):
1250
1270
    """A connection shared between several transports."""
1583
1603
                    possible_transports.append(t_same_connection)
1584
1604
                return t_same_connection
1585
1605
 
1586
 
    for proto, factory_list in transport_list_registry.iteritems():
 
1606
    for proto, factory_list in transport_list_registry.items():
1587
1607
        if proto is not None and base.startswith(proto):
1588
1608
            transport, last_err = _try_transport_factories(base, factory_list)
1589
1609
            if transport:
1735
1755
                 help="Read-only access of branches exported on the web.")
1736
1756
register_transport_proto('https://',
1737
1757
            help="Read-only access of branches exported on the web using SSL.")
 
1758
# The default http implementation is urllib, but https is pycurl if available
 
1759
register_lazy_transport('http://', 'bzrlib.transport.http._pycurl',
 
1760
                        'PyCurlTransport')
1738
1761
register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
1739
1762
                        'HttpTransport_urllib')
1740
1763
register_lazy_transport('https://', 'bzrlib.transport.http._urllib',
1741
1764
                        'HttpTransport_urllib')
1742
 
register_lazy_transport('http://', 'bzrlib.transport.http._pycurl',
1743
 
                        'PyCurlTransport')
1744
1765
register_lazy_transport('https://', 'bzrlib.transport.http._pycurl',
1745
1766
                        'PyCurlTransport')
1746
1767