mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Projucer: Updated URL::createInputStream() code to use URL::InputStreamOptions
This commit is contained in:
parent
fa8c446d0c
commit
4ea3053b1c
2 changed files with 16 additions and 9 deletions
|
|
@ -309,9 +309,9 @@ private:
|
|||
static ErrorMessageAndType runTask (std::unique_ptr<AccountEnquiryBase> accountEnquiryTask, LicenseState& state)
|
||||
{
|
||||
const ErrorMessageAndType cancelledError ("Cancelled.", ErrorType::cancelled);
|
||||
const String endpointURL = "https://api.juce.com/api/v1";
|
||||
const String endpointURL ("https://api.juce.com/api/v1");
|
||||
|
||||
auto url = URL (endpointURL + accountEnquiryTask->getEndpointURLSuffix());
|
||||
URL url (endpointURL + accountEnquiryTask->getEndpointURLSuffix());
|
||||
|
||||
auto isPOST = accountEnquiryTask->isPOSTLikeRequest();
|
||||
|
||||
|
|
@ -322,9 +322,11 @@ private:
|
|||
return cancelledError;
|
||||
|
||||
int statusCode = 0;
|
||||
auto urlStream = url.createInputStream (isPOST, nullptr, nullptr,
|
||||
accountEnquiryTask->getExtraHeaders(),
|
||||
5000, nullptr, &statusCode);
|
||||
auto urlStream = url.createInputStream (URL::InputStreamOptions (isPOST ? URL::ParameterHandling::inPostData
|
||||
: URL::ParameterHandling::inAddress)
|
||||
.withExtraHeaders (accountEnquiryTask->getExtraHeaders())
|
||||
.withConnectionTimeoutMs (5000)
|
||||
.withStatusCode (&statusCode));
|
||||
|
||||
if (urlStream == nullptr)
|
||||
return { "Failed to connect to the web server.", ErrorType::connectionError };
|
||||
|
|
|
|||
|
|
@ -48,9 +48,12 @@ std::unique_ptr<InputStream> VersionInfo::createInputStreamForAsset (const Asset
|
|||
URL downloadUrl (asset.url);
|
||||
StringPairArray responseHeaders;
|
||||
|
||||
return std::unique_ptr<InputStream> (downloadUrl.createInputStream (false, nullptr, nullptr,
|
||||
"Accept: application/octet-stream",
|
||||
5000, &responseHeaders, &statusCode, 1));
|
||||
return std::unique_ptr<InputStream> (downloadUrl.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress)
|
||||
.withExtraHeaders ("Accept: application/octet-stream")
|
||||
.withConnectionTimeoutMs (5000)
|
||||
.withResponseHeaders (&responseHeaders)
|
||||
.withStatusCode (&statusCode)
|
||||
.withNumRedirectsToFollow (1)));
|
||||
}
|
||||
|
||||
bool VersionInfo::isNewerVersionThanCurrent()
|
||||
|
|
@ -76,7 +79,9 @@ bool VersionInfo::isNewerVersionThanCurrent()
|
|||
std::unique_ptr<VersionInfo> VersionInfo::fetch (const String& endpoint)
|
||||
{
|
||||
URL latestVersionURL ("https://api.github.com/repos/juce-framework/JUCE/releases/" + endpoint);
|
||||
std::unique_ptr<InputStream> inStream (latestVersionURL.createInputStream (false, nullptr, nullptr, {}, 5000));
|
||||
|
||||
std::unique_ptr<InputStream> inStream (latestVersionURL.createInputStream (URL::InputStreamOptions (URL::ParameterHandling::inAddress)
|
||||
.withConnectionTimeoutMs (5000)));
|
||||
|
||||
if (inStream == nullptr)
|
||||
return nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue