| 1 |
<testcase> |
| 2 |
<info> |
| 3 |
<keywords> |
| 4 |
Metalink |
| 5 |
HTTP |
| 6 |
HTTP GET |
| 7 |
-J |
| 8 |
FILE |
| 9 |
</keywords> |
| 10 |
</info> |
| 11 |
|
| 12 |
# |
| 13 |
# Server-side |
| 14 |
<reply> |
| 15 |
<data nocheck="yes"> |
| 16 |
HTTP/1.1 200 OK |
| 17 |
Date: Thu, 21 Jun 2012 16:27:17 GMT |
| 18 |
Server: test-server/fake |
| 19 |
Content-Length: 46 |
| 20 |
Connection: close |
| 21 |
Content-Type: text/html |
| 22 |
Content-Disposition: filename=name2009; charset=funny; option=strange |
| 23 |
Funny-head: yesyes |
| 24 |
|
| 25 |
Some contents delivered from an HTTP resource |
| 26 |
</data> |
| 27 |
</reply> |
| 28 |
|
| 29 |
# |
| 30 |
# Client-side |
| 31 |
<client> |
| 32 |
<features> |
| 33 |
file |
| 34 |
Metalink |
| 35 |
</features> |
| 36 |
<server> |
| 37 |
http |
| 38 |
</server> |
| 39 |
<name> |
| 40 |
Metalink 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> |
| 63 |
perl %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 |
<strip> |
| 71 |
^User-Agent:.* |
| 72 |
</strip> |
| 73 |
<protocol> |
| 74 |
GET /2009 HTTP/1.1 |
| 75 |
Host: %HOSTIP:%HTTPPORT |
| 76 |
Accept: */* |
| 77 |
|
| 78 |
</protocol> |
| 79 |
<file1 name="log/download2009"> |
| 80 |
Some contents delivered from an HTTP resource |
| 81 |
</file1> |
| 82 |
<stripfile2> |
| 83 |
s/Last-Modified:.*// |
| 84 |
</stripfile2> |
| 85 |
<file2 name="log/heads2009"> |
| 86 |
Content-Length: 496 |
| 87 |
Accept-ranges: bytes |
| 88 |
|
| 89 |
|
| 90 |
HTTP/1.1 200 OK |
| 91 |
Date: Thu, 21 Jun 2012 16:27:17 GMT |
| 92 |
Server: test-server/fake |
| 93 |
Content-Length: 46 |
| 94 |
Connection: close |
| 95 |
Content-Type: text/html |
| 96 |
Content-Disposition: filename=name2009; charset=funny; option=strange |
| 97 |
Funny-head: yesyes |
| 98 |
|
| 99 |
</file2> |
| 100 |
<file3 name="log/stdout2009"> |
| 101 |
</file3> |
| 102 |
<file4 name="log/stderr2009" mode="text"> |
| 103 |
Metalink: parsing (file://%PWD/log/test2009.metalink) metalink/XML... |
| 104 |
Metalink: parsing (file://%PWD/log/test2009.metalink) OK |
| 105 |
Metalink: fetching (log/download2009) from (http://%HOSTIP:%HTTPPORT/2009)... |
| 106 |
Metalink: fetching (log/download2009) from (http://%HOSTIP:%HTTPPORT/2009) OK |
| 107 |
Metalink: validating (log/download2009)... |
| 108 |
Metalink: validating (log/download2009) [sha-256] OK |
| 109 |
</file4> |
| 110 |
<stripfile4> |
| 111 |
$_ = '' if (($_ !~ /^Metalink: /) && ($_ !~ /error/i) && ($_ !~ /warn/i)) |
| 112 |
</stripfile4> |
| 113 |
</verify> |
| 114 |
</testcase> |