mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-28 22:24:16 +00:00
add xmlrpc-c 1.03.14 to in tree libs
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3772 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
6d9679b164
commit
3abb7730b2
338 files changed
+98032
-2
No files matched your search
@@ -0,0 +1,56 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "xmlrpc_config.h"
|
||||
|
||||
#include "test.h"
|
||||
#include "cgi.h"
|
||||
|
||||
static const char cgiResponse1[] =
|
||||
"....Status: 200 OK\n"
|
||||
"Content-type: text/xml; charset=\"utf-8\"\n"
|
||||
"Content-length: 141\n"
|
||||
"\n"
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
|
||||
"<methodResponse>\r\n"
|
||||
"<params>\r\n"
|
||||
"<param><value><i4>12</i4></value></param>\r\n"
|
||||
"</params>\r\n"
|
||||
"</methodResponse>\r\n";
|
||||
|
||||
|
||||
|
||||
void
|
||||
test_server_cgi(void) {
|
||||
/*----------------------------------------------------------------------------
|
||||
Here, we pretend to be a web server when someone has requested a POST
|
||||
to the CGI script "cgitest1".
|
||||
-----------------------------------------------------------------------------*/
|
||||
FILE * cgiOutputP;
|
||||
|
||||
printf("Running CGI tests...\n");
|
||||
|
||||
cgiOutputP = popen("REQUEST_METHOD=POST "
|
||||
"CONTENT_TYPE=text/xml "
|
||||
"CONTENT_LENGTH=211 "
|
||||
"./cgitest1 "
|
||||
"<sample_add_call.xml",
|
||||
"r");
|
||||
|
||||
if (cgiOutputP == NULL)
|
||||
TEST_ERROR("Unable to run 'cgitest' program.");
|
||||
else {
|
||||
unsigned char cgiResponse[4096];
|
||||
size_t bytesRead;
|
||||
|
||||
bytesRead = fread(cgiResponse, 1, sizeof(cgiResponse), cgiOutputP);
|
||||
|
||||
TEST(bytesRead == strlen(cgiResponse1));
|
||||
|
||||
TEST(memcmp(cgiResponse, cgiResponse1, bytesRead) == 0);
|
||||
}
|
||||
printf("\n");
|
||||
printf("CGI tests done.\n");
|
||||
}
|
||||
Reference in new issue
Block a user