[RFC] Multipart support for _urllib_

Michael Ellerman michael at ellerman.id.au
Sat Jun 17 10:13:51 BST 2006

Hi guys,

I've cleaned up the work I did to do multipart HTTP. Actually I
started from scratch, I think it's reasonably readable now.

For the moment it doesn't handle the case of sending too many ranges
to the server. Now that we sort the offsets, we get much better
combining. I'm seeing at most 16 ranges get sent, which should be ok
for most servers you'd hope. To be robust we should probably support
falling back to a full request if we get a 400 for a range request.

Currently I've hooked it into urllib, because I can't for the life of
me work out how to get the "Content-range" header out of pycurl. I
don't think it can be done in fact. So hooking this up to pycurl will
require a kludge, if we get back a non-multipart 206 we'll just have
to assume it contains the union of all the ranges we requested plus
any gaps.

It doesn't do connection sharing or any of that, we can sort that out later.

I haven't written any tests for this yet, that requires writing a
python server that does multipart responses, sigh. It seems to work ok
though, I can branch bzr.dev :)

Also at http://michael.ellerman.id.au/bzr/branches/http


ps. Don't forget you need "http+urllib://foo" urls to test this!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: http-multipart.bundle.patch
Type: text/x-patch
Size: 12972 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060617/8f729209/attachment.bin 

More information about the bazaar mailing list