test2006 2.7 KB

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