lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 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 | <server> |
| 26 | http |
| 27 | </server> |
| 28 | <name> |
| 29 | --libcurl for GET with query |
| 30 | </name> |
| 31 | <setenv> |
| 32 | SSL_CERT_FILE= |
| 33 | </setenv> |
| 34 | <command> |
| 35 | http://%HOSTIP:%HTTPPORT/we/want/1403 --libcurl log/test1403.c -G -d "foo=bar" -d "baz=quux" |
| 36 | </command> |
| 37 | </client> |
| 38 | |
| 39 | # Verify data after the test has been "shot" |
| 40 | <verify> |
| 41 | <strip> |
| 42 | ^User-Agent:.* |
| 43 | </strip> |
| 44 | <protocol> |
| 45 | GET /we/want/1403?foo=bar&baz=quux HTTP/1.1
|
| 46 | User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
|
| 47 | Host: %HOSTIP:%HTTPPORT
|
| 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 | </stripfile> |
| 60 | <file name="log/test1403.c" mode="text"> |
| 61 | /********* Sample code generated by the curl command line tool ********** |
| 62 | * All curl_easy_setopt() options are documented at: |
| 63 | * https://curl.haxx.se/libcurl/c/curl_easy_setopt.html |
| 64 | ************************************************************************/ |
| 65 | #include <curl/curl.h> |
| 66 | |
| 67 | int main(int argc, char *argv[]) |
| 68 | { |
| 69 | CURLcode ret; |
| 70 | CURL *hnd; |
| 71 | |
| 72 | hnd = curl_easy_init(); |
| 73 | curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); |
| 74 | curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/1403?foo=bar&baz=quux"); |
| 75 | curl_easy_setopt(hnd, CURLOPT_HEADER, 1L); |
| 76 | curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped"); |
| 77 | curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); |
| 78 | curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); |
| 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 select to either not use them or implement |
| 83 | them yourself. |
| 84 | |
| 85 | CURLOPT_WRITEDATA set to a objectpointer |
| 86 | CURLOPT_INTERLEAVEDATA set to a objectpointer |
| 87 | CURLOPT_WRITEFUNCTION set to a functionpointer |
| 88 | CURLOPT_READDATA set to a objectpointer |
| 89 | CURLOPT_READFUNCTION set to a functionpointer |
| 90 | CURLOPT_SEEKDATA set to a objectpointer |
| 91 | CURLOPT_SEEKFUNCTION set to a functionpointer |
| 92 | CURLOPT_ERRORBUFFER set to a objectpointer |
| 93 | CURLOPT_STDERR set to a objectpointer |
| 94 | CURLOPT_DEBUGFUNCTION set to a functionpointer |
| 95 | CURLOPT_DEBUGDATA set to a objectpointer |
| 96 | CURLOPT_HEADERFUNCTION set to a functionpointer |
| 97 | CURLOPT_HEADERDATA set to a objectpointer |
| 98 | |
| 99 | */ |
| 100 | |
| 101 | ret = curl_easy_perform(hnd); |
| 102 | |
| 103 | curl_easy_cleanup(hnd); |
| 104 | hnd = NULL; |
| 105 | |
| 106 | return (int)ret; |
| 107 | } |
| 108 | /**** End of sample code ****/ |
| 109 | </file> |
| 110 | </verify> |
| 111 | </testcase> |