test1400 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <testcase>
  2. <info>
  3. <keywords>
  4. HTTP
  5. HTTP GET
  6. --libcurl
  7. </keywords>
  8. </info>
  9. # Server-side
  10. <reply>
  11. <data>
  12. HTTP/1.1 200 OK
  13. Date: Thu, 29 Jul 2008 14:49:00 GMT
  14. Server: test-server/fake
  15. Content-Length: 0
  16. Connection: close
  17. </data>
  18. </reply>
  19. # Client-side
  20. <client>
  21. <server>
  22. http
  23. </server>
  24. <name>
  25. --libcurl for simple HTTP GET
  26. </name>
  27. <setenv>
  28. SSL_CERT_FILE=
  29. </setenv>
  30. <command>
  31. http://%HOSTIP:%HTTPPORT/we/want/1400 --libcurl log/test1400.c
  32. </command>
  33. </client>
  34. # Verify data after the test has been "shot"
  35. <verify>
  36. <strip>
  37. ^User-Agent:.*
  38. </strip>
  39. <protocol>
  40. GET /we/want/1400 HTTP/1.1
  41. User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
  42. Host: %HOSTIP:%HTTPPORT
  43. Accept: */*
  44. </protocol>
  45. <stripfile>
  46. s/(USERAGENT, \")[^\"]+/${1}stripped/
  47. # CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
  48. # configurations - just ignore them
  49. $_ = '' if /CURLOPT_SSL_VERIFYPEER/
  50. $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
  51. $_ = '' if /CURLOPT_HTTP_VERSION/
  52. </stripfile>
  53. <file name="log/test1400.c" mode="text">
  54. /********* Sample code generated by the curl command line tool **********
  55. * All curl_easy_setopt() options are documented at:
  56. * https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
  57. ************************************************************************/
  58. #include <curl/curl.h>
  59. int main(int argc, char *argv[])
  60. {
  61. CURLcode ret;
  62. CURL *hnd;
  63. hnd = curl_easy_init();
  64. curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
  65. curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/1400");
  66. curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
  67. curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
  68. curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
  69. curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
  70. /* Here is a list of options the curl code used that cannot get generated
  71. as source easily. You may select to either not use them or implement
  72. them yourself.
  73. CURLOPT_WRITEDATA set to a objectpointer
  74. CURLOPT_INTERLEAVEDATA set to a objectpointer
  75. CURLOPT_WRITEFUNCTION set to a functionpointer
  76. CURLOPT_READDATA set to a objectpointer
  77. CURLOPT_READFUNCTION set to a functionpointer
  78. CURLOPT_SEEKDATA set to a objectpointer
  79. CURLOPT_SEEKFUNCTION set to a functionpointer
  80. CURLOPT_ERRORBUFFER set to a objectpointer
  81. CURLOPT_STDERR set to a objectpointer
  82. CURLOPT_DEBUGFUNCTION set to a functionpointer
  83. CURLOPT_DEBUGDATA set to a objectpointer
  84. CURLOPT_HEADERFUNCTION set to a functionpointer
  85. CURLOPT_HEADERDATA set to a objectpointer
  86. */
  87. ret = curl_easy_perform(hnd);
  88. curl_easy_cleanup(hnd);
  89. hnd = NULL;
  90. return (int)ret;
  91. }
  92. /**** End of sample code ****/
  93. </file>
  94. </verify>
  95. </testcase>