~bzr-pqm/bzr/bzr.dev

Read http responses on demand without buffering the whole body
response.

* bzrlib/transport/http/response.py:
New implementation of handle_response with only one RangeFile
class covering all the needs. The main purpose is to read the data
on demand instead of buffering everything at the beginning. The
main target is readv but get needs are addressed as well.
(RangeFile): Respect socket use by handling ranges on the fly and
never seeking backwards.
(HttpRangeResponse, HttpMultipartRangeResponse): Deleted.
(handle_response): The 'headers' parameter is now an HTTPMessage
containing the response headers. Stop handling 4xx error codes,
the clients do that themselves.

* bzrlib/transport/http/_urllib2_wrappers.py:
(AbstractHTTPConnection.cleanup_pipe): Renamed from 'fake_close'
the new name is more appropriate and less scary (the content is the
same though).
(HTTPDefaultErrorHandler.http_error_default): Stop handling 416
here to get a finer control in the layer above.

* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib._perform): Cleanup the httplib pipe before
each request so that clients can leave it dirty without worrying.
(HttpTransport_urllib._get): Add 416 as an expected error so that
we handle it (_urllib2_wrappers was handling it before).
(HttpTransport_urllib._get): Handle 400 and 416 errors here. Don't
bother cleaning the pipe anymore.
(HttpTransport_urllib._post, HttpTransport_urllib._head): Don't
bother cleaning the pipe anymore.

* bzrlib/transport/http/_pycurl.py:
(PyCurlTransport._get_ranged): Handle 400 and 416 errors
here. Also use HTTPMessage to replace the _extract_headers use.
(PyCurlTransport._parse_headers): New method. Create an
HTTPMessage from the raw headers provided by pycurl.

* bzrlib/transport/http/__init__.py:
(_extract_headers): Deleted. HTTPMessage is a better alternative.
(HttpTransportBase.get): Wrap the result in a StringIO since same
callers want an iterable, stop gap to make the tests pass, MUST be
fixed.
(HttpTransportBase._readv): Also catch InvalidHttpRange.
(HttpTransportBase._coalesce_readv): Indicates that only
InvalidHttpRange (not InvalidRange) can be raised from there.

* bzrlib/transport/__init__.py:
(_CoalescedOffset.__repr__): Provided by jam and lost in previous
patches.

* bzrlib/tests/test_transport_implementations.py:
(TransportTests.test_get): Switch from zip() to itertools.imap or
the transport requests are all issued before reading the files.
This works for sftp since several file-handles can be created on a
single ssh connection, for ftp since all get() are StringIO
buffered (bang head against desktop) and used to work with http
before the http response rewriting.

* bzrlib/tests/test_http_response.py: Test the new RangeFile
implementation, get rid of now useless tests. All deleted tests
have been reviewed to avoid test coverage regression.

* bzrlib/tests/HttpServer.py:
(TestingHTTPRequestHandler.get_multiple_ranges): Only one boundary
line per part should be written.

* bzrlib/errors.py:
(InvalidRange.__init__): The msg was duplicated.
(InvalidHttpRange.__init__): Add an optional 'msg' attribute.

Filename Latest Rev Last Changed Committer Comment Size
..
bzrlib 1185.1.29 19 years ago Robert Collins merge merge tweaks from aaron, which includes late Diff
contrib 1185.1.29 19 years ago Robert Collins merge merge tweaks from aaron, which includes late Diff
doc 1185.1.29 19 years ago Robert Collins merge merge tweaks from aaron, which includes late Diff
man1 2425.1.1 17 years ago Robert Collins ``make docs`` now creates a man page at ``man1/bzr Diff
tools 1185.1.29 19 years ago Robert Collins merge merge tweaks from aaron, which includes late Diff
.bzrignore 2872.1.2 17 years ago Martin Pool Ignore .pyd files in bzr tree (windows C extension 825 bytes Diff Download File
.rsyncexclude 1185.33.36 19 years ago Martin Pool Exclude more files from dumb-rsync upload 203 bytes Diff Download File
BRANCH.TODO 2399.1.16 17 years ago John Arbash Meinel [merge] bzr.dev 2466 150 bytes Diff Download File
File bzr 2955.3.1 17 years ago Alexander Belchenko start 0.93 development cycle; deprecate osutils.ba 4 KB Diff Download File
bzr.ico 1861.2.16 18 years ago Alexander Belchenko new official bzr.ico 7.2 KB Diff Download File
COPYING.txt 1861.2.9 18 years ago Alexander Belchenko rename gpl.txt => COPYING.txt 17.5 KB Diff Download File
File generate_docs.py 2911.6.1 17 years ago Blake Winton Change 'print >> f,'s to 'f.write('s. 2.9 KB Diff Download File
index.txt 2977.1.3 17 years ago Ian Clatworthy 1st cut at the 'Personal version control' chapter Empty Diff Download File
INSTALL 2696.2.4 17 years ago Aaron Bentley Fix typo 1.4 KB Diff Download File
Makefile 2977.1.14 17 years ago Ian Clatworthy change Makefile to support tutorials 6.2 KB Diff Download File
NEWS 3059.2.1 17 years ago Vincent Ladeuil merge fix for bug #172701, work continued on top o 188 KB Diff Download File
profile_imports.py 1996.3.36 18 years ago John Arbash Meinel [merge] bzr.dev 2070 5.4 KB Diff Download File
README 2688.1.1 17 years ago Ian Clatworthy Added link to registration survey to README 2.8 KB Diff Download File
File setup.py 2911.6.1 17 years ago Blake Winton Change 'print >> f,'s to 'f.write('s. 10.5 KB Diff Download File
TODO 2382.2.5 17 years ago Martin Pool Contents of TODO file moved into bug tracker 115 bytes Diff Download File