6 #include "xmlrpc_config.h"
11 static const char cgiResponse1[] =
12 "....Status: 200 OK\n"
13 "Content-type: text/xml; charset=\"utf-8\"\n"
14 "Content-length: 141\n"
16 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
17 "<methodResponse>\r\n"
19 "<param><value><i4>12</i4></value></param>\r\n"
21 "</methodResponse>\r\n";
24 #define TESTDATA_DIR "data"
25 #define DIRSEP DIRECTORY_SEPARATOR
28 test_server_cgi(void) {
29 /*----------------------------------------------------------------------------
30 Here, we pretend to be a web server when someone has requested a POST
31 to the CGI script "cgitest1".
32 -----------------------------------------------------------------------------*/
35 printf("Running CGI tests...\n");
37 cgiOutputP = popen("REQUEST_METHOD=POST "
38 "CONTENT_TYPE=text/xml "
42 TESTDATA_DIR DIRSEP "sample_add_call.xml",
45 if (cgiOutputP == NULL)
46 TEST_ERROR("Unable to run 'cgitest' program.");
48 unsigned char cgiResponse[4096];
51 bytesRead = fread(cgiResponse, 1, sizeof(cgiResponse), cgiOutputP);
53 TEST(bytesRead == strlen(cgiResponse1));
55 TEST(memcmp(cgiResponse, cgiResponse1, bytesRead) == 0);
59 printf("CGI tests done.\n");