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 16:27:17 GMT
18Server: test-server/fake
19Content-Length: 46
20Connection: close
21Content-Type: text/html
22Content-Disposition: filename=name2009; charset=funny; option=strange
23Funny-head: yesyes
24
25Some contents delivered from an HTTP resource
26</data>
27</reply>
28
29#
30# Client-side
31<client>
32<features>
33file
34Metalink
35</features>
36<server>
37http
38</server>
39 <name>
40Metalink local XML file, HTTP resource, using -o fname -J -D file
41 </name>
42<command option="no-output,no-include">
43--metalink file://%PWD/log/test2009.metalink -J -o log/outfile2009 -D log/heads2009
44</command>
45# local metalink file written before test command runs
46<file name="log/test2009.metalink">
47<?xml version="1.0" encoding="utf-8"?>
48<metalink version="3.0" xmlns="http://www.metalinker.org/">
49 <files>
50  <file name="log/download2009">
51   <verification>
52    <hash type="md5">we-only-check-the-strongest-hash-provided</hash>
53    <hash type="sha256">e4c5b83384ba7d5f8e201d61747a14f29baacd7dfadce0fbd56661db4bba72b2</hash>
54   </verification>
55   <resources maxconnections="1">
56    <url type="http" preference="90">http://%HOSTIP:%HTTPPORT/2009</url>
57   </resources>
58  </file>
59 </files>
60</metalink>
61</file>
62<postcheck>
63perl %SRCDIR/libtest/notexists.pl log/2009 log/name2009 log/outfile2009
64</postcheck>
65</client>
66
67#
68# Verify data after the test has been "shot"
69<verify>
70<protocol>
71GET /2009 HTTP/1.1
72Host: %HOSTIP:%HTTPPORT
73User-Agent: curl/%VERSION
74Accept: */*
75
76</protocol>
77<file1 name="log/download2009">
78Some contents delivered from an HTTP resource
79</file1>
80# The Content-Length replace here is to handle with 4/5 digit port number in
81# the content
82<stripfile2>
83s/Last-Modified:.*//
84s/Content-Length: 49[67]/Content-Length: yeps/
85</stripfile2>
86<file2 name="log/heads2009">
87Content-Length: yeps
88Accept-ranges: bytes
89
90
91HTTP/1.1 200 OK
92Date: Thu, 21 Jun 2012 16:27:17 GMT
93Server: test-server/fake
94Content-Length: 46
95Connection: close
96Content-Type: text/html
97Content-Disposition: filename=name2009; charset=funny; option=strange
98Funny-head: yesyes
99
100</file2>
101<file3 name="log/stdout2009">
102</file3>
103<file4 name="log/stderr2009" mode="text">
104Metalink: parsing (file://%PWD/log/test2009.metalink) metalink/XML...
105Metalink: parsing (file://%PWD/log/test2009.metalink) OK
106Metalink: fetching (log/download2009) from (http://%HOSTIP:%HTTPPORT/2009)...
107Metalink: fetching (log/download2009) from (http://%HOSTIP:%HTTPPORT/2009) OK
108Metalink: validating (log/download2009)...
109Metalink: validating (log/download2009) [sha-256] OK
110</file4>
111<stripfile4>
112$_ = '' if (($_ !~ /^Metalink: /) && ($_ !~ /error/i) && ($_ !~ /warn/i))
113</stripfile4>
114</verify>
115</testcase>
116