CURLOPT_TRANSFER_ENCODING supported since Curl > 7.21.6
[ppastats.git] / src / http.c
index 4b7b27f..7fda573 100644 (file)
@@ -91,7 +91,10 @@ static char *fetch_url(const char *url)
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cbk_curl);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, content);
        curl_easy_setopt(curl, CURLOPT_USERAGENT, "ppastats/0.0");
+#ifdef CURLOPT_TRANSFER_ENCODING
+       /* added since Curl 7.21.7 */
        curl_easy_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1);
+#endif
 
        if (curl_easy_perform(curl) == CURLE_OK) {
                curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code);
@@ -151,9 +154,8 @@ char *get_url_content(const char *url, unsigned int use_cache)
        if (use_cache)
                content = fcache_get(url + 7);
 
-       if (!content) {
+       if (!content)
                content = fetch_url(url);
-       }
 
        if (use_cache && content)
                fcache_put(url + 7, content);