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

macOS: Support infinite timeouts for URL connections

This commit is contained in:
ed 2021-06-18 14:59:30 +01:00
parent f93cdf431a
commit efd0373525

View file

@ -1106,9 +1106,17 @@ private:
if (NSURL* nsURL = [NSURL URLWithString: juceStringToNS (url.toString (! addParametersToRequestBody))])
{
const auto timeOutSeconds = [this]
{
if (timeOutMs > 0)
return timeOutMs / 1000.0;
return timeOutMs < 0 ? std::numeric_limits<double>::infinity() : 60.0;
}();
if (NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL: nsURL
cachePolicy: NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval: timeOutMs <= 0 ? 60.0 : (timeOutMs / 1000.0)])
timeoutInterval: timeOutSeconds])
{
if (NSString* httpMethod = [NSString stringWithUTF8String: httpRequestCmd.toRawUTF8()])
{