~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-04-16 11:08:11 UTC
  • mfrom: (6521 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6522.
  • Revision ID: jelmer@samba.org-20120416110811-0y996ihqy9o2bb1t
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from __future__ import absolute_import
23
23
 
24
 
from cStringIO import StringIO
 
24
import os
25
25
import re
26
26
import urlparse
27
27
import sys
119
119
        :param relpath: The relative path to the file
120
120
        """
121
121
        code, response_file = self._get(relpath, None)
122
 
        # FIXME: some callers want an iterable... One step forward, three steps
123
 
        # backwards :-/ And not only an iterable, but an iterable that can be
124
 
        # seeked backwards, so we will never be able to do that.  One such
125
 
        # known client is bzrlib.bundle.serializer.v4.get_bundle_reader. At the
126
 
        # time of this writing it's even the only known client -- vila20071203
127
 
        return StringIO(response_file.read())
 
122
        return response_file
128
123
 
129
124
    def _get(self, relpath, ranges, tail_amount=0):
130
125
        """Get a file, or part of a file.
242
237
                    # Split the received chunk
243
238
                    for offset, size in cur_coal.ranges:
244
239
                        start = cur_coal.start + offset
245
 
                        rfile.seek(start, 0)
 
240
                        rfile.seek(start, os.SEEK_SET)
246
241
                        data = rfile.read(size)
247
242
                        data_len = len(data)
248
243
                        if data_len != size: