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