| @@ -309,9 +309,9 @@ private: | |||||
| static ErrorMessageAndType runTask (std::unique_ptr<AccountEnquiryBase> accountEnquiryTask, LicenseState& state) | static ErrorMessageAndType runTask (std::unique_ptr<AccountEnquiryBase> accountEnquiryTask, LicenseState& state) | ||||
| { | { | ||||
| const ErrorMessageAndType cancelledError ("Cancelled.", ErrorType::cancelled); | 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(); | auto isPOST = accountEnquiryTask->isPOSTLikeRequest(); | ||||
| @@ -322,9 +322,11 @@ private: | |||||
| return cancelledError; | return cancelledError; | ||||
| int statusCode = 0; | 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) | if (urlStream == nullptr) | ||||
| return { "Failed to connect to the web server.", ErrorType::connectionError }; | 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); | URL downloadUrl (asset.url); | ||||
| StringPairArray responseHeaders; | 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() | bool VersionInfo::isNewerVersionThanCurrent() | ||||
| @@ -76,7 +79,9 @@ bool VersionInfo::isNewerVersionThanCurrent() | |||||
| std::unique_ptr<VersionInfo> VersionInfo::fetch (const String& endpoint) | std::unique_ptr<VersionInfo> VersionInfo::fetch (const String& endpoint) | ||||
| { | { | ||||
| URL latestVersionURL ("https://api.github.com/repos/juce-framework/JUCE/releases/" + 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) | if (inStream == nullptr) | ||||
| return nullptr; | return nullptr; | ||||