1<testcase>
2<info>
3<keywords>
4Metalink
5HTTP
6HTTP GET
7-J
8</keywords>
9</info>
10
11#
12# Server-side
13<reply>
14<data nocheck="yes">
15HTTP/1.1 200 OK
16Date: Thu, 21 Jun 2012 14:50:02 GMT
17Server: test-server/fake
18Content-Length: 42
19Connection: close
20Content-Type: text/html
21Content-Disposition: filename=name2007; charset=funny; option=strange
22Funny-head: yesyes
23
24Something delivered from an HTTP resource
25</data>
26</reply>
27
28#
29# Client-side
30<client>
31# This relies on the debug feature to allow us to set directory to store the
32# -O and -J output in, using the CURL_TESTDIR variable. This test might use
33# it upon failure only, successful execution won't actually use it.
34<features>
35debug
36file
37Metalink
38</features>
39<server>
40http
41</server>
42 <name>
43Metalink local XML file, HTTP resource, using -O -J -D file
44 </name>
45<setenv>
46CURL_TESTDIR=%PWD/log
47</setenv>
48<command option="no-output,no-include">
49--metalink file://%PWD/log/test2007.metalink -J -O -D log/heads2007
50</command>
51# local metalink file written before test command runs
52<file name="log/test2007.metalink">
53<?xml version="1.0" encoding="utf-8"?>
54<metalink version="3.0" xmlns="http://www.metalinker.org/">
55 <files>
56  <file name="log/download2007">
57   <verification>
58    <hash type="md5">we-only-check-the-strongest-hash-provided</hash>
59    <hash type="sha256">52899e30f80e3490632d505653204e1fb5b02bda141048704ce9a0ed00b8a3f5</hash>
60   </verification>
61   <resources maxconnections="1">
62    <url type="http" preference="90">http://%HOSTIP:%HTTPPORT/2007</url>
63   </resources>
64  </file>
65 </files>
66</metalink>
67</file>
68<postcheck>
69perl %SRCDIR/libtest/notexists.pl log/2007 log/name2007
70</postcheck>
71</client>
72
73#
74# Verify data after the test has been "shot"
75<verify>
76<strip>
77^User-Agent:.*
78</strip>
79<protocol>
80GET /2007 HTTP/1.1
81Host: %HOSTIP:%HTTPPORT
82Accept: */*
83
84</protocol>
85<file1 name="log/download2007">
86Something delivered from an HTTP resource
87</file1>
88<file2 name="log/heads2007">
89HTTP/1.1 200 OK
90Date: Thu, 21 Jun 2012 14:50:02 GMT
91Server: test-server/fake
92Content-Length: 42
93Connection: close
94Content-Type: text/html
95Content-Disposition: filename=name2007; charset=funny; option=strange
96Funny-head: yesyes
97
98</file2>
99<file3 name="log/stdout2007">
100</file3>
101<file4 name="log/stderr2007">
102Metalink: parsing (file://%PWD/log/test2007.metalink) metalink/XML...
103Metalink: parsing (file://%PWD/log/test2007.metalink) OK
104Metalink: fetching (log/download2007) from (http://%HOSTIP:%HTTPPORT/2007)...
105Metalink: fetching (log/download2007) from (http://%HOSTIP:%HTTPPORT/2007) OK
106Metalink: validating (log/download2007)...
107Metalink: validating (log/download2007) [sha-256] OK
108</file4>
109<stripfile4>
110$_ = '' if (($_ !~ /^Metalink: /) && ($_ !~ /error/i) && ($_ !~ /warn/i))
111</stripfile4>
112</verify>
113</testcase>
114