2012-02-23 04:48:46 -05:00
|
|
|
<testcase>
|
|
|
|
<info>
|
|
|
|
<keywords>
|
|
|
|
HTTP
|
2012-03-22 13:32:19 -04:00
|
|
|
HTTP GET
|
2012-02-23 04:48:46 -05:00
|
|
|
--libcurl
|
|
|
|
</keywords>
|
|
|
|
</info>
|
|
|
|
|
|
|
|
# Server-side
|
|
|
|
<reply>
|
|
|
|
<data>
|
|
|
|
HTTP/1.1 200 OK
|
|
|
|
Date: Thu, 29 Jul 2008 14:49:00 GMT
|
|
|
|
Server: test-server/fake
|
|
|
|
Content-Length: 0
|
|
|
|
Connection: close
|
|
|
|
|
|
|
|
</data>
|
|
|
|
</reply>
|
|
|
|
|
|
|
|
# Client-side
|
|
|
|
<client>
|
|
|
|
<server>
|
|
|
|
http
|
|
|
|
</server>
|
|
|
|
<name>
|
|
|
|
--libcurl for simple HTTP GET
|
|
|
|
</name>
|
2017-03-12 17:33:56 -04:00
|
|
|
<setenv>
|
|
|
|
SSL_CERT_FILE=
|
|
|
|
</setenv>
|
2012-02-23 04:48:46 -05:00
|
|
|
<command>
|
2021-03-12 11:38:26 -05:00
|
|
|
http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER --libcurl log/test%TESTNUMBER.c
|
2012-02-23 04:48:46 -05:00
|
|
|
</command>
|
|
|
|
</client>
|
|
|
|
|
|
|
|
# Verify data after the test has been "shot"
|
|
|
|
<verify>
|
|
|
|
<protocol>
|
2021-03-12 11:38:26 -05:00
|
|
|
GET /we/want/%TESTNUMBER HTTP/1.1
|
2012-02-23 17:13:42 -05:00
|
|
|
Host: %HOSTIP:%HTTPPORT
|
2020-10-02 07:45:24 -04:00
|
|
|
User-Agent: curl/%VERSION
|
2012-02-23 17:13:42 -05:00
|
|
|
Accept: */*
|
|
|
|
|
2012-02-23 04:48:46 -05:00
|
|
|
</protocol>
|
|
|
|
<stripfile>
|
|
|
|
s/(USERAGENT, \")[^\"]+/${1}stripped/
|
2015-12-13 03:24:08 -05:00
|
|
|
# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
|
2019-05-14 04:03:54 -04:00
|
|
|
# CURLOPT_INTERLEAVEDATA requires RTSP protocol
|
2015-12-13 03:24:08 -05:00
|
|
|
# configurations - just ignore them
|
2012-02-23 04:48:46 -05:00
|
|
|
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
2012-02-23 17:13:42 -05:00
|
|
|
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
|
2015-12-13 03:24:08 -05:00
|
|
|
$_ = '' if /CURLOPT_HTTP_VERSION/
|
2018-12-17 09:46:56 -05:00
|
|
|
$_ = '' if /CURLOPT_HTTP09_ALLOWED/
|
2019-05-14 04:03:54 -04:00
|
|
|
$_ = '' if /CURLOPT_INTERLEAVEDATA/
|
2012-02-23 04:48:46 -05:00
|
|
|
</stripfile>
|
2021-03-12 11:38:26 -05:00
|
|
|
<file name="log/test%TESTNUMBER.c" mode="text">
|
2012-02-23 04:48:46 -05:00
|
|
|
/********* Sample code generated by the curl command line tool **********
|
|
|
|
* All curl_easy_setopt() options are documented at:
|
2020-11-04 08:02:01 -05:00
|
|
|
* https://curl.se/libcurl/c/curl_easy_setopt.html
|
2012-02-23 04:48:46 -05:00
|
|
|
************************************************************************/
|
|
|
|
#include <curl/curl.h>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
CURLcode ret;
|
|
|
|
CURL *hnd;
|
|
|
|
|
|
|
|
hnd = curl_easy_init();
|
2017-04-24 06:03:08 -04:00
|
|
|
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
|
2021-03-12 11:38:26 -05:00
|
|
|
curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER");
|
2012-02-23 04:48:46 -05:00
|
|
|
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
|
|
|
|
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
|
|
|
|
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
2020-12-11 07:55:00 -05:00
|
|
|
%if ftp
|
2020-11-24 08:56:57 -05:00
|
|
|
curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
|
2020-12-11 07:55:00 -05:00
|
|
|
%endif
|
2012-02-23 04:48:46 -05:00
|
|
|
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
|
|
|
|
|
|
|
/* Here is a list of options the curl code used that cannot get generated
|
|
|
|
as source easily. You may select to either not use them or implement
|
|
|
|
them yourself.
|
|
|
|
|
|
|
|
CURLOPT_WRITEDATA set to a objectpointer
|
|
|
|
CURLOPT_WRITEFUNCTION set to a functionpointer
|
|
|
|
CURLOPT_READDATA set to a objectpointer
|
|
|
|
CURLOPT_READFUNCTION set to a functionpointer
|
|
|
|
CURLOPT_SEEKDATA set to a objectpointer
|
|
|
|
CURLOPT_SEEKFUNCTION set to a functionpointer
|
|
|
|
CURLOPT_ERRORBUFFER set to a objectpointer
|
|
|
|
CURLOPT_STDERR set to a objectpointer
|
|
|
|
CURLOPT_DEBUGFUNCTION set to a functionpointer
|
|
|
|
CURLOPT_DEBUGDATA set to a objectpointer
|
2012-05-25 04:33:28 -04:00
|
|
|
CURLOPT_HEADERFUNCTION set to a functionpointer
|
|
|
|
CURLOPT_HEADERDATA set to a objectpointer
|
2012-02-23 04:48:46 -05:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
ret = curl_easy_perform(hnd);
|
|
|
|
|
|
|
|
curl_easy_cleanup(hnd);
|
|
|
|
hnd = NULL;
|
|
|
|
|
|
|
|
return (int)ret;
|
|
|
|
}
|
|
|
|
/**** End of sample code ****/
|
|
|
|
</file>
|
|
|
|
</verify>
|
|
|
|
</testcase>
|