1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Add a User-Agent http header to curl requests

This commit is contained in:
hogliux 2016-07-07 09:47:43 +01:00
parent c552872fd6
commit f83554c966

View file

@ -133,10 +133,16 @@ private:
const int maxRedirects, const String& headers,
bool isPost, const String& httpRequest, size_t postSize)
{
curl_version_info_data* data = curl_version_info (CURLVERSION_NOW);
jassert (data != nullptr);
String userAgent = String ("curl/") + data->version;
if (curl_easy_setopt (curl, CURLOPT_URL, address.toRawUTF8()) == CURLE_OK
&& curl_easy_setopt (curl, CURLOPT_WRITEDATA, this) == CURLE_OK
&& curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, StaticCurlWrite) == CURLE_OK
&& curl_easy_setopt (curl, CURLOPT_MAXREDIRS, static_cast<long> (maxRedirects)) == CURLE_OK)
&& curl_easy_setopt (curl, CURLOPT_MAXREDIRS, static_cast<long> (maxRedirects)) == CURLE_OK
&& curl_easy_setopt (curl, CURLOPT_USERAGENT, userAgent.toRawUTF8()) == CURLE_OK)
{
if (isPost)
{