Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.9.0
-
None
Description
FileTransfer tests were recently updated to test for malformed URLs in upload and download. iOS is failing those tests as it is returning a bad connection error rather than a bad URL error.
The URL being tested is: httpssss://ex ample.com (note the space between the x and a in example).
iOS creates the URL for the file transfer by escaping the url string passed in. Thus, the space gets escaped and the call to create the URL works and a valid URL is created:
NSURL *url = [NSURL URLWithString:[server stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
iOS catches the error when it actually tries to communicate with the server and returns the connection error.
This can be fixed by not escaping the string or NOT escaping the entire string when creating the URL. Also, should httpssss:// fail? The docs indicate the the
[NSURL urlWithString] api does test against the spec and will return nil if the url created is not valid:
"Must be a URL that conforms to RFC 2396. This method parses URLString according to RFCs 1738 and 1808. " and "An NSURL object initialized with URLString. If the string was malformed, returns nil."