[PEAK] Downloading via redirection

Phillip J. Eby pje at telecommunity.com
Sat Mar 24 11:43:23 EDT 2007


At 12:20 AM 3/24/2007 -0400, Yang wrote:
>On 3/23/07, Phillip J. Eby pje-at-telecommunity.com |python-peak|
><...> wrote:
>>At 08:58 PM 3/23/2007 -0400, Yang wrote:
>> >But when easy_install requests
>> >http://assorted.sf.net/python-commons/download/ (which it apparently
>> >does, based on the output), won't the HTTP response inform it of the
>> >filename and type (and thus it can see that it's downloading
>> >python-commons-0.1.tar.gz)?
>>
>>No, because when it follows a home page or download link, it's looking for
>>an HTML page that it can find download URLs on -- not the actual download
>>file.  At that point, it hasn't chosen *which* URL is the best match for
>>your criteria, so it's not expecting to download anything yet, only to look
>>at web pages for *links* to downloads.
>
>So why not simply check (once you're fetching the download-URL)
>whether it's a web page, as you normally expect (text/html), or
>whether it's in fact a tar.gz (or other acceptable filetype)?

Because:

1. When you're searching for a package by name/version, it needs to know 
the version *before* downloading, so it can pick the best version.  (Which 
includes giving compatible binary distributions precedence over source 
distributions.)

2. It loads web pages into memory, rather than saving them to disk.




More information about the PEAK mailing list