cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Metalink support patch for curl

From: Tatsuhiro Tsujikawa <tatsuhiro.t_at_gmail.com>
Date: Mon, 11 Jun 2012 01:35:51 +0900

On Sun, May 27, 2012 at 6:29 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Sun, 27 May 2012, Tatsuhiro Tsujikawa wrote:
>
>> OK, I fixed conflicts. Patch attached. In addition to fixing conflict, I
>> reduced #ifdef HAVE_LIBMETALINK in tool_operate.c that you concerned
>> earlier. That is the last patch in the patch set.
>
>
> Thank you! I had to do a little extra fix to make it build without metalink,
> but once in I merged and pushed the lot! 21 commits which totalled in:
>
>  21 files changed, 1003 insertions(+), 23 deletions(-)
>
> Oh, and I adjusted a few of your commit messsages to use a shorter first
> line of the commit message as we want that to be within 50-60 columns
> something.
>
> We now need to add a few test cases for this feature. To see how a test case
> can be done, see tests/README and compare with a simple HTTP test such as
> tests/data/test1 ...
>

The attached patch adds 2 Metalink test cases.

test2005 is simple one: parse local metalink file and download the URI
described there.

test2006 is more complicated:
1. First download Metalink file from HTTP server
2. Parse Metalink file and extract URI to download
3. Download extracted URI

The hard part is that the URI in the Metalink file downloaded step 1
must has host and
ip address set up to the host and ip which is currently running the test.
The test script has variable substitution feature and %HOSTIP and %HTTPPORT
will be the way to go, but reply data does not support variable
substitution right now.
So I dig into HTTP server sws source code and hacked and added
extension to request URI parser
to allow the HTTP server to return file content as reply.

The URL format is as follows:
The URL and file name must be separated single '!' character. In
this case, the number following the last slash is ignored but is
still needed. The file name cannot include '/' and must be
relative to the log directory. The file should be created in
<file> section. For example, the URL
http://%HOSTIP:%HTTPPORT/1!test.txt will make the HTTP server
return the content of the file denoted by log/test.txt.

I chosen '!' because no test data used it in request URI.
All test passed (except 507?, which is always fails in my environment).

What do you think this extension?

Best regards,

Tatsuhiro Tsujikawa

> For everyone: please proceed and try this out. I'm sure there are a few
> rough edges still around that will need some polish but we can certainly use
> some help to find them!
>
>
> --
>
>  / daniel.haxx.se
> -------------------------------------------------------------------
> 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-06-10