X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Flibtest%2Flib555.c;h=c887b56f0b8a0daa01cef78aa5e856dbf759cb89;hb=cfd75dcdb18d0a4291f48020211c65507a97d9eb;hp=e84af87e51648d64c7ef00a22f1763484bbad69d;hpb=24b9957402f17c422eeeb3386bf049feeb342e78;p=platform%2Fupstream%2Fcurl.git diff --git a/tests/libtest/lib555.c b/tests/libtest/lib555.c index e84af87..c887b56 100644 --- a/tests/libtest/lib555.c +++ b/tests/libtest/lib555.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -35,7 +35,15 @@ #define TEST_HANG_TIMEOUT 60 * 1000 -#define UPLOADTHIS "this is the blurb we want to upload\n" +static const char uploadthis[] = +#ifdef CURL_DOES_CONVERSIONS + /* ASCII representation with escape sequences for non-ASCII platforms */ + "\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 + "this is the blurb we want to upload\n"; +#endif static size_t readcallback(void *ptr, size_t size, @@ -51,10 +59,10 @@ static size_t readcallback(void *ptr, } (*counter)++; /* bump */ - if(size * nmemb > strlen(UPLOADTHIS)) { + if(size * nmemb > strlen(uploadthis)) { fprintf(stderr, "READ!\n"); - strcpy(ptr, UPLOADTHIS); - return strlen(UPLOADTHIS); + strcpy(ptr, uploadthis); + return strlen(uploadthis); } fprintf(stderr, "READ NOT FINE!\n"); return 0; @@ -77,9 +85,9 @@ int test(char *URL) { int res = 0; CURL *curl = NULL; - int counter=0; + int counter = 0; CURLM *m = NULL; - int running=1; + int running = 1; start_test_timing(); @@ -98,13 +106,9 @@ int test(char *URL) easy_setopt(curl, CURLOPT_READDATA, &counter); /* We CANNOT do the POST fine without setting the size (or choose chunked)! */ - easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(UPLOADTHIS)); + easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(uploadthis)); easy_setopt(curl, CURLOPT_POST, 1L); -#ifdef CURL_DOES_CONVERSIONS - /* Convert the POST data to ASCII. */ - easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); -#endif easy_setopt(curl, CURLOPT_PROXY, libtest_arg2); easy_setopt(curl, CURLOPT_PROXYUSERPWD, libtest_arg3); easy_setopt(curl, CURLOPT_PROXYAUTH, @@ -141,7 +145,7 @@ int test(char *URL) /* At this point, maxfd is guaranteed to be greater or equal than -1. */ - select_test(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); + select_test(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout); abort_on_test_timeout(); }