test2007 2.7 KB

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