blob: 5ecf2d28cc04b06cfbdc96ae6ba38a94b646e323 [file] [log] [blame]
xf.li6c8fc1e2023-08-12 00:11:09 -07001<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<setenv>
32SSL_CERT_FILE=
33</setenv>
34 <command>
35http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER --libcurl log/test%TESTNUMBER.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<protocol>
42GET /we/want/%TESTNUMBER?foo=bar&baz=quux HTTP/1.1
43Host: %HOSTIP:%HTTPPORT
44User-Agent: curl/%VERSION
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, SSH_KNOWNHOSTS and HTTP_VERSION vary with
52# configurations - just ignore them
53$_ = '' if /CURLOPT_SSL_VERIFYPEER/
54$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
55$_ = '' if /CURLOPT_HTTP_VERSION/
56$_ = '' if /CURLOPT_INTERLEAVEDATA/
57</stripfile>
58<file name="log/test%TESTNUMBER.c" mode="text">
59/********* Sample code generated by the curl command line tool **********
60 * All curl_easy_setopt() options are documented at:
61 * https://curl.se/libcurl/c/curl_easy_setopt.html
62 ************************************************************************/
63#include <curl/curl.h>
64
65int main(int argc, char *argv[])
66{
67 CURLcode ret;
68 CURL *hnd;
69
70 hnd = curl_easy_init();
71 curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
72 curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER\?foo=bar&baz=quux");
73 curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
74 curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
75 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
76%if ftp
77 curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
78%endif
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_WRITEDATA was set to an object pointer
86 CURLOPT_WRITEFUNCTION was set to a function pointer
87 CURLOPT_READDATA was set to an object pointer
88 CURLOPT_READFUNCTION was set to a function pointer
89 CURLOPT_SEEKDATA was set to an object pointer
90 CURLOPT_SEEKFUNCTION was set to a function pointer
91 CURLOPT_ERRORBUFFER was set to an object pointer
92 CURLOPT_STDERR was set to an object pointer
93 CURLOPT_DEBUGFUNCTION was set to a function pointer
94 CURLOPT_DEBUGDATA was set to an object pointer
95 CURLOPT_HEADERFUNCTION was set to a function pointer
96 CURLOPT_HEADERDATA 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>