[Python-Dev] Adding resume (206) support to urllib(2)
Fredrik Lundh
fredrik at pythonware.com
Wed Dec 13 08:58:46 CET 2006
Martin v. Löwis wrote:
>> given that urllib2 already supports partial requests, I'm not sure I see
>> the point of reimplementing this on top of httplib. an example:
>>
>> import urllib2
>>
>> request = urllib2.Request("http://www.pythonware.com/daily/index.htm")
>> request.add_header("range", "bytes=0-999")
>
> But what does this do if the URL was a file URL, or an ftp URL?
same thing as if you use range on a HTTP server that doesn't support
ranges. you get all the data, and there's no content-range field in
the response header.
> You have to know the syntax of the range header, and you have to
> know the syntax of the content-range header, to process it. With
> that, you can just as easily use httplib:
I'm not sure "as easily" is the right way to describe something that
requires more code but yet leaves out practical things as redirection
support, host and user-agent headers, etc.
</F>
More information about the Python-Dev
mailing list