test2006 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <testcase>
  2. <info>
  3. <keywords>
  4. Metalink
  5. HTTP
  6. HTTP GET
  7. FILE
  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: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. Some data 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 output in, using the CURL_TESTDIR variable. This test might use it upon
  30. # 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 -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/test2006.metalink -O -D log/heads2006
  47. </command>
  48. # local metalink file written before test command runs
  49. <file name="log/test2006.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/download2006">
  54. <verification>
  55. <hash type="md5">we-only-check-the-strongest-hash-provided</hash>
  56. <hash type="sha256">319cb6be756734b7ff689628ca3265580cdae6a0e38f42d4ac612ff4fba143b0</hash>
  57. </verification>
  58. <resources maxconnections="1">
  59. <url type="http" preference="90">http://%HOSTIP:%HTTPPORT/2006</url>
  60. </resources>
  61. </file>
  62. </files>
  63. </metalink>
  64. </file>
  65. <postcheck>
  66. perl %SRCDIR/libtest/notexists.pl log/2006 log/name2006
  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 /2006 HTTP/1.1
  77. Host: %HOSTIP:%HTTPPORT
  78. Accept: */*
  79. </protocol>
  80. <file1 name="log/download2006">
  81. Some data delivered from an HTTP resource
  82. </file1>
  83. <file2 name="log/heads2006">
  84. Content-Length: 496
  85. Accept-ranges: bytes
  86. HTTP/1.1 200 OK
  87. Date: Thu, 21 Jun 2012 14:49:01 GMT
  88. Server: test-server/fake
  89. Content-Length: 42
  90. Connection: close
  91. Content-Type: text/html
  92. Content-Disposition: filename=name2006; charset=funny; option=strange
  93. Funny-head: yesyes
  94. </file2>
  95. <file3 name="log/stdout2006">
  96. </file3>
  97. <file4 name="log/stderr2006">
  98. Metalink: parsing (file://%PWD/log/test2006.metalink) metalink/XML...
  99. Metalink: parsing (file://%PWD/log/test2006.metalink) OK
  100. Metalink: fetching (log/download2006) from (http://%HOSTIP:%HTTPPORT/2006)...
  101. Metalink: fetching (log/download2006) from (http://%HOSTIP:%HTTPPORT/2006) OK
  102. Metalink: validating (log/download2006)...
  103. Metalink: validating (log/download2006) [sha-256] OK
  104. </file4>
  105. <stripfile2>
  106. s/Last-Modified:.*//
  107. </stripfile2>
  108. <stripfile4>
  109. $_ = '' if (($_ !~ /^Metalink: /) && ($_ !~ /error/i) && ($_ !~ /warn/i))
  110. </stripfile4>
  111. </verify>
  112. </testcase>