summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2016-08-17 13:36:36 -0400
committerJoel Fischer <joeljfischer@gmail.com>2016-08-17 13:36:36 -0400
commit34abd39c87d4e17cb679643ebd8eff0dc9e5c3c6 (patch)
tree1ddd30bf87bf993c61b5285b059fc80712167d6b
parent8366aa44d300cf2ca5c73488b34bb7110fc11914 (diff)
parent339373f85e1eada821631ddc9150d6e3a30e2709 (diff)
downloadsdl_ios-34abd39c87d4e17cb679643ebd8eff0dc9e5c3c6.tar.gz
Merge branch 'master' into release/4.2.04.2.0
# Conflicts: # CHANGELOG.md # README.md # SmartDeviceLink-iOS.podspec # SmartDeviceLink/Info.plist # SmartDeviceLink/SDLProxy.m # docs/Classes.html # docs/Classes/SDLAbstractProtocol.html # docs/Classes/SDLProtocol.html # docs/Classes/SDLProtocolHeader.html # docs/Classes/SDLProxy.html # docs/Classes/SDLStreamingMediaManager.html # docs/Constants.html # docs/Enums.html # docs/Enums/SDLStreamingVideoError.html # docs/Protocols.html # docs/Protocols/SDLProtocolListener.html # docs/undocumented.json
-rw-r--r--CHANGELOG.md4
-rw-r--r--SmartDeviceLink/SDLURLSession.m11
2 files changed, 15 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a45dbbd51..83868b9e7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,10 @@
* Store sessionIds and service metadata together in the protocol code (#350).
* Fixed a streaming media manager enum casing issue by deprecating the incorrect cased enum and adding a correctly cased one (#383, #411).
+# 4.1.5 Release Notes
+### Bug Fixes
+* Since Apple is disallowing virtually all HTTP requests in Jan. 2017, SDLURLSession will now take all HTTP requests and attempt them over HTTPS. Some cars off the line still have HTTP URLs hardcoded into them, therefore this is a necessary precaution.
+
# 4.1.4 Release Notes
### Bug Fixes
* Fixed exception causing app to crash when SDL Core disconnects in TCP debug mode. Warning: The app may enter an undefined connection state as there is currently no retry strategy in TCP debug mode.
diff --git a/SmartDeviceLink/SDLURLSession.m b/SmartDeviceLink/SDLURLSession.m
index 363c6fbad..3e2ad6e1c 100644
--- a/SmartDeviceLink/SDLURLSession.m
+++ b/SmartDeviceLink/SDLURLSession.m
@@ -62,6 +62,11 @@ static float DefaultConnectionTimeout = 45.0;
#pragma mark - URL Request Methods
- (void)dataFromURL:(NSURL *)url completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler {
+ // Apple no longer allows HTTP URLs without a special exception as of Jan. 2017
+ if ([url.scheme isEqualToString:@"http"]) {
+ url = [NSURL URLWithString:[url.absoluteString stringByReplacingOccurrencesOfString:@"http" withString:@"https"]];
+ }
+
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:self.cachePolicy timeoutInterval:self.connectionTimeout];
SDLURLRequestTask *task = [[SDLURLRequestTask alloc] initWithURLRequest:request completionHandler:completionHandler];
@@ -71,7 +76,13 @@ static float DefaultConnectionTimeout = 45.0;
}
- (void)uploadWithURLRequest:(NSURLRequest *)request data:(NSData *)data completionHandler:(SDLURLConnectionRequestCompletionHandler)completionHandler {
+ NSURL *newURL = nil;
+ if ([request.URL.scheme isEqualToString:@"http"]) {
+ newURL = [NSURL URLWithString:[request.URL.absoluteString stringByReplacingOccurrencesOfString:@"http" withString:@"https"]];
+ }
+
NSMutableURLRequest *mutableRequest = [request mutableCopy];
+ mutableRequest.URL = newURL;
mutableRequest.HTTPBody = data;
mutableRequest.HTTPMethod = @"POST";