cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Metalink support patch for curl

From: Tatsuhiro Tsujikawa <tatsuhiro.t_at_gmail.com>
Date: Fri, 4 May 2012 22:44:58 +0900

On Fri, May 4, 2012 at 3:18 PM, Anthony Bryan <anthonybryan_at_gmail.com> wrote:
> On Sat, Apr 28, 2012 at 11:30 AM,  <curl-users-request_at_cool.haxx.se> wrote:
>>
>>   1. Re: Metalink support patch for curl (Tatsuhiro Tsujikawa)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Sun, 29 Apr 2012 00:30:00 +0900
>> From: Tatsuhiro Tsujikawa <tatsuhiro.t_at_gmail.com>
>> To: the curl tool <curl-users_at_cool.haxx.se>
>> Subject: Re: Metalink support patch for curl
>> Message-ID:
>>        <CAPyZ6=LXQ+Vzy1+OS6N22_BC6Pv2oU9d70MbC4n3W6RuXMqehg_at_mail.gmail.com>
>> Content-Type: text/plain; charset="windows-1252"
>>
>> Hi,
>>
>> On Sat, Apr 28, 2012 at 4:56 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
>>> On Sat, 28 Apr 2012, Tatsuhiro Tsujikawa wrote:
>>>
>>>> I finally updated my 3year-old Metalink support patch to the curl master
>>>> branch. The patch is attached.
>>>
>>>
>>> Thanks Tatsuhiro! I think the time has come for us to get proper metalink
>>> support added. Maybe not just yet though, see below...
>>>
>>>
>> For normal usecase, users don't use metalink file directly. Instead
>> they give URI to the metalink file to curl and expect it to download
>> the file described in it.
>> The first patch simply did not incorporate this usecase. In the
>> attached patch, I added this functionality. If the content-type of
>> downloaded file is application/metalink+xml, then get URLs from it and
>> add them to download queue.
>> Currently, we need metalink file must be saved in the local file, for
>> example, using -O, to make this feature work.
>>
>> So now you can download file using:
>>
>>  $ src/curl -O 'http://curl.haxx.se/metalink.cgi?curl=tar.lzma'
>>
>> I think directly reading local metalink file is useful for debugging.
>> The metalink file creators can check Metalink file without uploading
>> it to the web server.
>>
>> For -O, I wondered we should use curl default behavior for Metalink
>> download as well. I personally think user expects curl to download
>> file with the filename described in Metalink file. So in the attached
>> patch, I did this and now -O is not needed for metalink:
>>
>>  $ src/curl --metalink foo.metalink
>
> thank you, Tatsuhiro, for working on this! very cool to be able to use
> curl with metalink support.
>
> thanks to Daniel for reviewing as well!
>
> a couple comments and nits :)
>
> I have attached a patch to add Metalink info to INSTALL.
>

Thank you! I'll add this change to the patch set.

> for other documentation, eventually there should also be Metalink info
> in 'man curl'
> and add Metalink info to 'curl --help'
> add Metalink to "Features" list in 'curl --version' ?
> (I'm sure there's other places, but those are a good start :)
>

Yes, it is needed in the end.

> I noticed this text is used when downloading a metalink but not when
> using a local metalink (--metalink). maybe it should be displayed both
> times?:
>
> Parsing Metalink file: example.metalink
> Metalink file is parsed successfully
>

I don't oppose to print this message when --metalink is used.
I'll add necessary changes if there is no objection.

> also, this Metalink didn't work and I'm guessing others:
>
> http://openoffice.mirrorbrain.org/stable/3.3.0/OOo-SDK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz.metalink
>
> maybe something in the headers here?:
>
> Content-Disposition: attachment;
> filename="OOo-DK_3.3.0_Linux_x86-64_install-deb_en-US.tar.gz.metalink"
> Content-Type: application/metalink+xml; charset=UTF-8
>

The current patch does not take into account parameters like charset=UTF-8.
I'll handle this in the next patch.

> are hashes used yet to verify downloads? because if I tried to use a
> metalink twice but the file already existed and the checksum matched
> then it shouldn't download it again and it appears to do that now.
>

Not yet. Since checking checksum needs hash calculations and we depend on
the library for them, I first check the current curl code where hash
calculation is
implemented. I think the behavior of checking hash and deciding re-download is
debatable to suite curl project.

Best regards,

Tatsuhiro Tsujikawa

> thanks guys,
> --
> (( Anthony Bryan ... Metalink [ http://www.metalinker.org ]
>   )) Easier, More Reliable, Self Healing Downloads
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-users
> FAQ:        http://curl.haxx.se/docs/faq.html
> Etiquette:  http://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-05-04