diff options
author | Yang Tse <yangsita@gmail.com> | 2009-05-08 02:14:50 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-05-08 02:14:50 +0000 |
commit | c5c03ac5563961cbcbcb2a1cc3e8963d0c49e154 (patch) | |
tree | c013ab93163eb8640b52a0385b9d3a0c1706417b | |
parent | 6ca321ca75c8f8ad6808bcfd786ad8e84c790aff (diff) | |
download | curl-c5c03ac5563961cbcbcb2a1cc3e8963d0c49e154.tar.gz |
Fixes for non-ASCII platforms by David McCreedy
-rw-r--r-- | tests/libtest/lib506.c | 2 | ||||
-rw-r--r-- | tests/libtest/lib508.c | 5 | ||||
-rw-r--r-- | tests/libtest/lib510.c | 5 | ||||
-rw-r--r-- | tests/libtest/lib544.c | 7 | ||||
-rw-r--r-- | tests/libtest/lib547.c | 9 | ||||
-rw-r--r-- | tests/libtest/lib552.c | 5 | ||||
-rw-r--r-- | tests/libtest/lib553.c | 4 | ||||
-rw-r--r-- | tests/libtest/lib554.c | 23 | ||||
-rw-r--r-- | tests/libtest/lib555.c | 7 | ||||
-rw-r--r-- | tests/libtest/lib556.c | 14 |
10 files changed, 77 insertions, 4 deletions
diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index 34c774e5d..823e05d3e 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -132,7 +132,7 @@ static void *fire(void *ptr) /* build request url */ static char *suburl(const char *base, int i) { - return curl_maprintf("%s000%c", base, 48+i); + return curl_maprintf("%s%.4d", base, i); } diff --git a/tests/libtest/lib508.c b/tests/libtest/lib508.c index a709b80be..6de7e7bcd 100644 --- a/tests/libtest/lib508.c +++ b/tests/libtest/lib508.c @@ -63,6 +63,11 @@ int test(char *URL) /* Now specify we want to POST data */ curl_easy_setopt(curl, CURLOPT_POST, 1L); +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + /* Set the expected POST size */ curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)pooh.sizeleft); diff --git a/tests/libtest/lib510.c b/tests/libtest/lib510.c index 43ead0936..c890f9d45 100644 --- a/tests/libtest/lib510.c +++ b/tests/libtest/lib510.c @@ -78,6 +78,11 @@ int test(char *URL) /* Now specify we want to POST data */ curl_easy_setopt(curl, CURLOPT_POST, 1L); +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + /* we want to use our own read function */ curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); diff --git a/tests/libtest/lib544.c b/tests/libtest/lib544.c index 756291972..b17e64af2 100644 --- a/tests/libtest/lib544.c +++ b/tests/libtest/lib544.c @@ -13,7 +13,14 @@ #include "memdebug.h" static char teststring[] = +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape sequences for non-ASCII platforms */ + "\x54\x68\x69\x73\x00\x20\x69\x73\x20\x74\x65\x73\x74\x20\x62\x69\x6e\x61" + "\x72\x79\x20\x64\x61\x74\x61\x20\x77\x69\x74\x68\x20\x61\x6e\x20\x65\x6d" + "\x62\x65\x64\x64\x65\x64\x20\x4e\x55\x4c\x20\x62\x79\x74\x65\x0a"; +#else "This\0 is test binary data with an embedded NUL byte\n"; +#endif int test(char *URL) diff --git a/tests/libtest/lib547.c b/tests/libtest/lib547.c index 8a1070f70..a8f73eb5f 100644 --- a/tests/libtest/lib547.c +++ b/tests/libtest/lib547.c @@ -16,7 +16,14 @@ #include "memdebug.h" -#define UPLOADTHIS "this is the blurb we want to upload\n" +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape sequences for non-ASCII platforms */ +# define UPLOADTHIS "\x74\x68\x69\x73\x20\x69\x73\x20\x74\x68\x65\x20\x62" \ + "\x6c\x75\x72\x62\x20\x77\x65\x20\x77\x61\x6e\x74\x20" \ + "\x74\x6f\x20\x75\x70\x6c\x6f\x61\x64\x0a" +#else +# define UPLOADTHIS "this is the blurb we want to upload\n" +#endif #ifndef LIB548 static size_t readcallback(void *ptr, diff --git a/tests/libtest/lib552.c b/tests/libtest/lib552.c index ff2b8c986..ce7ca1676 100644 --- a/tests/libtest/lib552.c +++ b/tests/libtest/lib552.c @@ -169,6 +169,11 @@ int test(char *URL) /* Post */ curl_easy_setopt(curl, CURLOPT_POST, 1L); +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + /* Setup read callback */ curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) sizeof(databuf)); curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); diff --git a/tests/libtest/lib553.c b/tests/libtest/lib553.c index 0a6fdcbdb..7af9e4e42 100644 --- a/tests/libtest/lib553.c +++ b/tests/libtest/lib553.c @@ -70,6 +70,10 @@ int test(char *URL) curl_easy_setopt(curl, CURLOPT_URL, URL); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); curl_easy_setopt(curl, CURLOPT_POST, 1L); +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)POSTLEN); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_HEADER, 1L); diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c index 2999aea08..0a7c35d54 100644 --- a/tests/libtest/lib554.c +++ b/tests/libtest/lib554.c @@ -12,7 +12,15 @@ #include "memdebug.h" -static char data[]="this is what we post to the silly web server\n"; +static char data[]= +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape sequences for non-ASCII platforms */ + "\x74\x68\x69\x73\x20\x69\x73\x20\x77\x68\x61\x74\x20\x77\x65\x20\x70" + "\x6f\x73\x74\x20\x74\x6f\x20\x74\x68\x65\x20\x73\x69\x6c\x6c\x79\x20" + "\x77\x65\x62\x20\x73\x65\x72\x76\x65\x72\x0a"; +#else + "this is what we post to the silly web server\n"; +#endif struct WriteThis { char *readptr; @@ -70,7 +78,14 @@ int test(char *URL) formrc = curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "filename", +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape + sequences for non-ASCII platforms */ + CURLFORM_COPYCONTENTS, + "\x70\x6f\x73\x74\x69\x74\x32\x2e\x63", +#else CURLFORM_COPYCONTENTS, "postit2.c", +#endif CURLFORM_END); if(formrc) @@ -80,7 +95,13 @@ int test(char *URL) formrc = curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "submit", +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape + sequences for non-ASCII platforms */ + CURLFORM_COPYCONTENTS, "\x73\x65\x6e\x64", +#else CURLFORM_COPYCONTENTS, "send", +#endif CURLFORM_END); if(formrc) diff --git a/tests/libtest/lib555.c b/tests/libtest/lib555.c index 33a1a26c7..0b9d27ae0 100644 --- a/tests/libtest/lib555.c +++ b/tests/libtest/lib555.c @@ -93,6 +93,10 @@ int test(char *URL) curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(UPLOADTHIS)); curl_easy_setopt(curl, CURLOPT_POST, 1L); +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII. */ + curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif curl_easy_setopt(curl, CURLOPT_PROXY, libtest_arg2); curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, libtest_arg3); curl_easy_setopt(curl, CURLOPT_PROXYAUTH, @@ -124,6 +128,9 @@ int test(char *URL) mp_timedout = TRUE; break; } +#ifdef TPF + sleep(1); /* avoid ctl-10 dump */ +#endif if (running <= 0) { fprintf(stderr, "nothing left running.\n"); break; diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c index cb57f763b..1466e40c0 100644 --- a/tests/libtest/lib556.c +++ b/tests/libtest/lib556.c @@ -46,8 +46,16 @@ int test(char *URL) if(!res) { /* we are connected, now get a HTTP document the raw way */ - const char *request = "GET /556 HTTP/1.2\r\n" + const char *request = +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape sequences for non-ASCII platforms */ + "\x47\x45\x54\x20\x2f\x35\x35\x36\x20\x48\x54\x54\x50\x2f\x31\x2e" + "\x32\x0d\x0a\x48\x6f\x73\x74\x3a\x20\x6e\x69\x6e\x6a\x61\x0d\x0a" + "\x0d\x0a"; +#else + "GET /556 HTTP/1.2\r\n" "Host: ninja\r\n\r\n"; +#endif size_t iolen; char buf[1024]; @@ -61,6 +69,10 @@ int test(char *URL) /* busy-read like crazy */ res = curl_easy_recv(curl, buf, 1024, &iolen); +#ifdef TPF + sleep(1); /* avoid ctl-10 dump */ +#endif + if(iolen) /* send received stuff to stdout */ write(STDOUT_FILENO, buf, iolen); |