test1403 2.6 KB

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