--- libaitwww/example/test.c 2012/03/09 12:33:41 1.1.2.4 +++ libaitwww/example/test.c 2013/01/17 14:55:00 1.3.6.1 @@ -1,5 +1,6 @@ #include #include +#include #include @@ -10,7 +11,7 @@ showPair(struct tagCGI *c, void *arg) printf("ARG=%s ... ", arg); printf("next=%p ... ", c->cgi_node.sle_next); - printf("name=%s(%hhx) value=%s(%hhx)\n", c->cgi_name, *c->cgi_name, c->cgi_value, *c->cgi_value); + printf("name=%s value=%s\n", AIT_GET_STR(c->cgi_name), AIT_GET_STR(c->cgi_value)); return 0; } @@ -33,7 +34,8 @@ main(int argc, char **argv) } printf("%s\n%s\n", www_getValue(cgi, "testche"), www_getValue(cgi, "test1")); - cgi1 = www_parseQuery("blahA=this is a string&blahB=this is another string"); + + cgi1 = www_parseQuery("blahA=this%20is+a%20string&blahB=this is another string"); if (!cgi1) { printf("Error:: #%d - %s\n", www_GetErrno(), www_GetError()); www_closeCGI(&cgi); @@ -55,10 +57,14 @@ main(int argc, char **argv) www_closeCGI(&cgi1); } else { - /* POST test */ + /* POST test */ putenv("REQUEST_METHOD=POST"); putenv("CONTENT_LENGTH=1000"); - putenv("CONTENT_TYPE=application/x-www-form-urlencoded"); + if (!strcmp(argv[1], "multi")) + putenv("CONTENT_TYPE=multipart/form-data; boundary=012345678909876543210"); + else + putenv("CONTENT_TYPE=application/x-www-form-urlencoded"); + cgi = www_initCGI(); if (!cgi) { printf("Error:: #%d - %s\n", www_GetErrno(), www_GetError());