test2007 2.8 KB

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