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