Malformed NSURL's make phonegap integration difficult #67

Closed
robotony opened this Issue Aug 2, 2012 · 4 comments

Projects

None yet

4 participants

@robotony
robotony commented Aug 2, 2012

All the URL's loaded by the sdk are malformed and return a null host name. When integrating into a PhoneGap app it's typical to restrict URL access in the app with a whitelist. But the whitelist can't work against a nil/null host. The issue is in the HTTPRiot source: HRRequestOperation.m, composedURL

[NSURL URLWithString:[[baseURL absoluteString] stringByAppendingPathComponent:_path]];

Constructing the URL in this manner results in a url with a single slash after the scheme, for example:
baseURL="http://something.uservoice.com"
_path = "/api/v1/client.json"

using stringByAppendingPathComponent results in
"http:/something.uservoice.com/api/v1/client.json"

Is you ask for the host from this NSURL you always get nil. I'd recommend not using stringByAppendingPathComponent to construct the URL.

@nforgetkabam

I just ran into this same issue.

@austintaylor
Member

Fixed in 1.2.2

@nforgetkabam

Excellent. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment