mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fix for HTTPS POST requests with keep-alive failing on OS X versions below 10.10
This commit is contained in:
parent
1066a6d4ca
commit
a08cedb793
1 changed files with 16 additions and 0 deletions
|
|
@ -391,6 +391,7 @@ public:
|
|||
connection (nil),
|
||||
data ([[NSMutableData data] retain]),
|
||||
headers (nil),
|
||||
nsUrlErrorCode (0),
|
||||
statusCode (0),
|
||||
initialised (false),
|
||||
hasFailed (false),
|
||||
|
|
@ -508,6 +509,7 @@ public:
|
|||
void didFailWithError (NSError* error)
|
||||
{
|
||||
DBG (nsStringToJuce ([error description])); ignoreUnused (error);
|
||||
nsUrlErrorCode = [error code];
|
||||
hasFailed = true;
|
||||
initialised = true;
|
||||
signalThreadShouldExit();
|
||||
|
|
@ -552,6 +554,7 @@ public:
|
|||
NSURLConnection* connection;
|
||||
NSMutableData* data;
|
||||
NSDictionary* headers;
|
||||
NSInteger nsUrlErrorCode;
|
||||
int statusCode;
|
||||
bool initialised, hasFailed, hasFinished;
|
||||
const int numRedirectsToFollow;
|
||||
|
|
@ -744,7 +747,20 @@ private:
|
|||
connection = new URLConnectionState (req, numRedirectsToFollow);
|
||||
|
||||
if (! connection->start (progressCallback, progressCallbackContext))
|
||||
{
|
||||
// Workaround for deployment targets below 10.10 where HTTPS POST requests with keep-alive fail with the NSURLErrorNetworkConnectionLost error code
|
||||
#if ! (JUCE_IOS || (defined (__MAC_OS_X_VERSION_MIN_REQUIRED) && defined (__MAC_10_10) && __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10))
|
||||
if (connection->nsUrlErrorCode == NSURLErrorNetworkConnectionLost)
|
||||
{
|
||||
connection = new URLConnectionState (req, numRedirectsToFollow);
|
||||
|
||||
if (connection->start (progressCallback, progressCallbackContext))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
connection = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue