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:
parent
c552872fd6
commit
f83554c966
1 changed files with 7 additions and 1 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue