test1400 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. <command>
  28. http://%HOSTIP:%HTTPPORT/we/want/1400 --libcurl log/test1400.c
  29. </command>
  30. </client>
  31. # Verify data after the test has been "shot"
  32. <verify>
  33. <strip>
  34. ^User-Agent:.*
  35. </strip>
  36. <protocol>
  37. GET /we/want/1400 HTTP/1.1
  38. User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
  39. Host: %HOSTIP:%HTTPPORT
  40. Accept: */*
  41. </protocol>
  42. <stripfile>
  43. s/(USERAGENT, \")[^\"]+/${1}stripped/
  44. # CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
  45. # ignore them
  46. $_ = '' if /CURLOPT_SSL_VERIFYPEER/
  47. $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
  48. </stripfile>
  49. <file name="log/test1400.c" mode="text">
  50. /********* Sample code generated by the curl command line tool **********
  51. * All curl_easy_setopt() options are documented at:
  52. * http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
  53. ************************************************************************/
  54. #include <curl/curl.h>
  55. int main(int argc, char *argv[])
  56. {
  57. CURLcode ret;
  58. CURL *hnd;
  59. hnd = curl_easy_init();
  60. curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/1400");
  61. curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
  62. curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
  63. curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
  64. curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
  65. curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
  66. /* Here is a list of options the curl code used that cannot get generated
  67. as source easily. You may select to either not use them or implement
  68. them yourself.
  69. CURLOPT_WRITEDATA set to a objectpointer
  70. CURLOPT_WRITEFUNCTION set to a functionpointer
  71. CURLOPT_READDATA set to a objectpointer
  72. CURLOPT_READFUNCTION set to a functionpointer
  73. CURLOPT_SEEKDATA set to a objectpointer
  74. CURLOPT_SEEKFUNCTION set to a functionpointer
  75. CURLOPT_ERRORBUFFER set to a objectpointer
  76. CURLOPT_STDERR set to a objectpointer
  77. CURLOPT_DEBUGFUNCTION set to a functionpointer
  78. CURLOPT_DEBUGDATA set to a objectpointer
  79. CURLOPT_HEADERFUNCTION set to a functionpointer
  80. CURLOPT_HEADERDATA set to a objectpointer
  81. */
  82. ret = curl_easy_perform(hnd);
  83. curl_easy_cleanup(hnd);
  84. hnd = NULL;
  85. return (int)ret;
  86. }
  87. /**** End of sample code ****/
  88. </file>
  89. </verify>
  90. </testcase>