| @@ -391,6 +391,7 @@ public: | |||||
| connection (nil), | connection (nil), | ||||
| data ([[NSMutableData data] retain]), | data ([[NSMutableData data] retain]), | ||||
| headers (nil), | headers (nil), | ||||
| nsUrlErrorCode (0), | |||||
| statusCode (0), | statusCode (0), | ||||
| initialised (false), | initialised (false), | ||||
| hasFailed (false), | hasFailed (false), | ||||
| @@ -508,6 +509,7 @@ public: | |||||
| void didFailWithError (NSError* error) | void didFailWithError (NSError* error) | ||||
| { | { | ||||
| DBG (nsStringToJuce ([error description])); ignoreUnused (error); | DBG (nsStringToJuce ([error description])); ignoreUnused (error); | ||||
| nsUrlErrorCode = [error code]; | |||||
| hasFailed = true; | hasFailed = true; | ||||
| initialised = true; | initialised = true; | ||||
| signalThreadShouldExit(); | signalThreadShouldExit(); | ||||
| @@ -552,6 +554,7 @@ public: | |||||
| NSURLConnection* connection; | NSURLConnection* connection; | ||||
| NSMutableData* data; | NSMutableData* data; | ||||
| NSDictionary* headers; | NSDictionary* headers; | ||||
| NSInteger nsUrlErrorCode; | |||||
| int statusCode; | int statusCode; | ||||
| bool initialised, hasFailed, hasFinished; | bool initialised, hasFailed, hasFinished; | ||||
| const int numRedirectsToFollow; | const int numRedirectsToFollow; | ||||
| @@ -744,7 +747,20 @@ private: | |||||
| connection = new URLConnectionState (req, numRedirectsToFollow); | connection = new URLConnectionState (req, numRedirectsToFollow); | ||||
| if (! connection->start (progressCallback, progressCallbackContext)) | 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; | connection = nullptr; | ||||
| } | |||||
| } | } | ||||
| } | } | ||||