~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: v.ladeuil+lp at free
  • Date: 2006-12-13 17:37:07 UTC
  • mto: (2323.7.1 redirection)
  • mto: This revision was merged to the branch mainline in revision 2390.
  • Revision ID: v.ladeuil+lp@free.fr-20061213173707-a1gflgoke6b3eboc
First rough http branch redirection implementation.

* bzrlib/transport/http/_urllib2_wrappers.py:
(Request.__init__): Unless told otherwise, redirections are
followed silently.
(HTTPRedirectHandler.http_error_30x): Follow redirection or return
a 30x error.

* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib._perform): Raises RedirectRequested if the
request requires it.
(HttpTransport_urllib._get): Update the request from the hints
parameter if needed.

* bzrlib/errors.py:
 (RedirectRequested): New TransportError.

* bzrlib/bzrdir.py:
(BzrDir.open_from_transport): Catch RedirectRequested and retry
with the redirected url until we get to the final destination.
(BzrDirFormat.probe_transport): Hints get to not follow the
redirections but instead tell us where this branch is redirected.

* bzrlib/transport/smart.py:
(SmartTransport.get): Add a 'hint' parameter.

* bzrlib/transport/sftp.py:
(SFTPTransport.get): Add a 'hint' parameter.

* bzrlib/transport/memory.py:
(MemoryTransport.get): Add a 'hint' parameter.

* bzrlib/transport/local.py:
(LocalTransport.get): Add a 'hint' parameter.

* bzrlib/transport/http/_pycurl.py:
(PyCurlTransport._get): Add a 'hint' parameter and pass it to
_get_full.

* bzrlib/transport/http/__init__.py:
(HttpTransportBase.get): Add a 'hint' parameter and pass
it to _get.

* bzrlib/transport/ftp.py:
(FtpTransport.get): Add a 'hint' parameter.

* bzrlib/transport/fakevfat.py:
(FakeVFATTransportDecorator.get): Add a 'hint' parameter and pass
it to the decorated transport.

* bzrlib/transport/decorator.py:
(TransportDecorator.get): Add a 'hint' parameter and pass it to the
decorated transport.

* bzrlib/transport/chroot.py:
(ChrootTransportDecorator.get): Add a 'hint' parameter. Delete a
duplicated definition of the method.

* bzrlib/transport/__init__.py:
(Transport.get): Add a 'hint' parameter.
(TransportLogger.get): Add a 'hint' parameter and pass it to the
        

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
        else:
117
117
            self._raise_curl_http_error(curl)
118
118
 
119
 
    def _get(self, relpath, ranges, tail_amount=0):
 
119
    def _get(self, relpath, ranges, tail_amount=0, hints={}):
120
120
        # This just switches based on the type of request
121
121
        if ranges is not None or tail_amount not in (0, None):
122
122
            return self._get_ranged(relpath, ranges, tail_amount=tail_amount)
123
123
        else:
124
 
            return self._get_full(relpath)
 
124
            return self._get_full(relpath, hints=hints)
125
125
 
126
126
    def _setup_get_request(self, curl, relpath):
127
127
        # Make sure we do a GET request. versions > 7.14.1 also set the
152
152
 
153
153
        return abspath, data, header
154
154
 
155
 
    def _get_full(self, relpath):
 
155
    def _get_full(self, relpath, hints):
156
156
        """Make a request for the entire file"""
157
157
        curl = self._curl
158
158
        abspath, data, header = self._setup_get_request(curl, relpath)