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