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