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