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