X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Fhttp.cc;h=465ce6186708c9d3c5eeb78fb0703343e4d7e056;hb=b6719ab469b16022edd830cb90bc476b17fa6743;hp=621c714c2f1c616166a105d21b7c0fca90d6bdbd;hpb=743e893ecbbaacd66d2832e9c3ae16404422a173;p=awesomized%2Flibmemcached diff --git a/libtest/http.cc b/libtest/http.cc index 621c714c..465ce618 100644 --- a/libtest/http.cc +++ b/libtest/http.cc @@ -87,7 +87,7 @@ static size_t http_get_result_callback(void *ptr, size_t size, size_t nmemb, voi vchar_t *_body= (vchar_t*)data; _body->resize(size * nmemb); - memcpy(&_body[0], ptr, _body->size()); + memcpy(&(*_body)[0], ptr, _body->size()); return _body->size(); } @@ -97,14 +97,14 @@ static void init(CURL *curl, const std::string& url) (void)http_get_result_callback; (void)curl; (void)url; +#if defined(HAVE_LIBCURL) && HAVE_LIBCURL if (HAVE_LIBCURL) { -#if defined(HAVE_LIBCURL) && HAVE_LIBCURL assert(curl); curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_USERAGENT, YATL_USERAGENT); -#endif } +#endif } HTTP::HTTP(const std::string& url_arg) : @@ -118,9 +118,9 @@ bool GET::execute() { (void)init; +#if defined(HAVE_LIBCURL) && HAVE_LIBCURL if (HAVE_LIBCURL) { -#if defined(HAVE_LIBCURL) && HAVE_LIBCURL CURL *curl= curl_easy_init(); init(curl, url()); @@ -134,17 +134,17 @@ bool GET::execute() curl_easy_cleanup(curl); return bool(retref == CURLE_OK); -#endif } +#endif return false; } bool POST::execute() { +#if defined(HAVE_LIBCURL) && HAVE_LIBCURL if (HAVE_LIBCURL) { -#if defined(HAVE_LIBCURL) && HAVE_LIBCURL CURL *curl= curl_easy_init();; init(curl, url()); @@ -158,17 +158,17 @@ bool POST::execute() curl_easy_cleanup(curl); return bool(retref == CURLE_OK); -#endif } +#endif return false; } bool TRACE::execute() { +#if defined(HAVE_LIBCURL) && HAVE_LIBCURL if (HAVE_LIBCURL) { -#if defined(HAVE_LIBCURL) && HAVE_LIBCURL CURL *curl= curl_easy_init();; init(curl, url()); @@ -183,18 +183,18 @@ bool TRACE::execute() curl_easy_cleanup(curl); return retref == CURLE_OK; -#endif } +#endif return false; } bool HEAD::execute() { +#if defined(HAVE_LIBCURL) && HAVE_LIBCURL if (HAVE_LIBCURL) { -#if defined(HAVE_LIBCURL) && HAVE_LIBCURL - CURL *curl= curl_easy_init();; + CURL *curl= curl_easy_init(); init(curl, url()); @@ -207,8 +207,8 @@ bool HEAD::execute() curl_easy_cleanup(curl); return retref == CURLE_OK; -#endif } +#endif return false; }