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