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<protocol>
78GET /2007 HTTP/1.1
79Host: %HOSTIP:%HTTPPORT
80User-Agent: curl/%VERSION
81Accept: */*
82
83</protocol>
84<file1 name="log/download2007">
85Something delivered from an HTTP resource
86</file1>
87# The Content-Length replace here is to handle with 4/5 digit port number in
88# the content
89<stripfile2>
90s/Last-Modified:.*//
91s/Content-Length: 49[67]/Content-Length: yeps/
92</stripfile2>
93<file2 name="log/heads2007">
94Content-Length: yeps
95Accept-ranges: bytes
96
97
98HTTP/1.1 200 OK
99Date: Thu, 21 Jun 2012 14:50:02 GMT
100Server: test-server/fake
101Content-Length: 42
102Connection: close
103Content-Type: text/html
104Content-Disposition: filename=name2007; charset=funny; option=strange
105Funny-head: yesyes
106
107</file2>
108<file3 name="log/stdout2007">
109</file3>
110<file4 name="log/stderr2007" mode="text">
111Metalink: parsing (file://%PWD/log/test2007.metalink) metalink/XML...
112Metalink: parsing (file://%PWD/log/test2007.metalink) OK
113Metalink: fetching (log/download2007) from (http://%HOSTIP:%HTTPPORT/2007)...
114Metalink: fetching (log/download2007) from (http://%HOSTIP:%HTTPPORT/2007) OK
115Metalink: validating (log/download2007)...
116Metalink: validating (log/download2007) [sha-256] OK
117</file4>
118<stripfile4>
119$_ = '' if (($_ !~ /^Metalink: /) && ($_ !~ /error/i) && ($_ !~ /warn/i))
120</stripfile4>
121</verify>
122</testcase>
123