]> granicus.if.org Git - curl/commitdiff
Fixes for non-ASCII platforms by David McCreedy
authorYang Tse <yangsita@gmail.com>
Fri, 8 May 2009 02:14:50 +0000 (02:14 +0000)
committerYang Tse <yangsita@gmail.com>
Fri, 8 May 2009 02:14:50 +0000 (02:14 +0000)
tests/libtest/lib506.c
tests/libtest/lib508.c
tests/libtest/lib510.c
tests/libtest/lib544.c
tests/libtest/lib547.c
tests/libtest/lib552.c
tests/libtest/lib553.c
tests/libtest/lib554.c
tests/libtest/lib555.c
tests/libtest/lib556.c

index 34c774e5dfd083c6bcafa6bc4dc51aeef87eac63..823e05d3e798c3d6b1c211c37ffa2f8b98894fb5 100644 (file)
@@ -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);
 }
 
 
index a709b80be5ed529806f7f188a9516c7a8b580bd3..6de7e7bcda80cfaf5189434e14b87736ae594ec3 100644 (file)
@@ -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);
 
index 43ead093606e9fefc6130b54226d631c04e473a1..c890f9d45e434c1d6262f735bc07f2f0254f6a62 100644 (file)
@@ -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);
 
index 7562919729cef3cf7cfcf934275e809bb82451e4..b17e64af2d2b844b1300a9f41f141ecb313a366e 100644 (file)
 #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)
index 8a1070f70a330dc7d66da307e130cc9d6375c974..a8f73eb5f31cf21eebacddd58777bcb8b63dda59 100644 (file)
 
 #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,
index ff2b8c9866cfa67bfeb140f71f2077088f9ebe19..ce7ca1676168a63b40c47533922060c680e77973 100644 (file)
@@ -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);
index 0a6fdcbdbffef4498a204674d4507586b90b6a19..7af9e4e421e4984fb4c080e44522a9f011531dd2 100644 (file)
@@ -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);
index 2999aea08a2424964fd37bf44c8db8b7fb405d5e..0a7c35d54a1c811009e78a52753d0100e64fcad4 100644 (file)
 
 #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)
index 33a1a26c72fc36ae91146d3552bbe4c6a09f4331..0b9d27ae008db7adcf14e16281879801f7582fc1 100644 (file)
@@ -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;
index cb57f763b3ae74d8013320a816b7f9e1fb2350e8..1466e40c026dc68b3fb4e2b2d3edb76c89a7ff56 100644 (file)
@@ -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);