quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

test1403 (2856B)


      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 Content-Type: text/plain
     18 Connection: close
     19 
     20 </data>
     21 </reply>
     22 
     23 # Client-side
     24 <client>
     25 <features>
     26 --libcurl
     27 </features>
     28 <server>
     29 http
     30 </server>
     31 <name>
     32 --libcurl for GET with query
     33 </name>
     34 <setenv>
     35 SSL_CERT_FILE=
     36 </setenv>
     37 <command>
     38 http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER --libcurl %LOGDIR/test%TESTNUMBER.c -G -d "foo=bar" -d "baz=quux"
     39 </command>
     40 </client>
     41 
     42 # Verify data after the test has been "shot"
     43 <verify>
     44 <protocol>
     45 GET /we/want/%TESTNUMBER?foo=bar&baz=quux HTTP/1.1
     46 Host: %HOSTIP:%HTTPPORT
     47 User-Agent: curl/%VERSION
     48 Accept: */*
     49 
     50 </protocol>
     51 <stripfile>
     52 # curl's default user-agent varies with version, libraries etc.
     53 s/(USERAGENT, \")[^\"]+/${1}stripped/
     54 # CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
     55 # configurations - just ignore them
     56 $_ = '' if /CURLOPT_SSL_VERIFYPEER/
     57 $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
     58 $_ = '' if /CURLOPT_HTTP_VERSION/
     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\?foo=bar&baz=quux");
     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>