twitter-archive / CocoaSPDY

SPDY for iOS and OS X
Apache License 2.0
2.39k stars 233 forks source link

URL encode the path #49

Closed kgoodier closed 10 years ago

kgoodier commented 10 years ago

NSURL's path property returns the path in non-escaped form per Apple's documentation and our observations. For instance:

NSURL *url = [[NSURL alloc] initWithString:@"https://example.com/foo/%E9%9F%B3%E6%A5%BD.json"];
// actual url.path: "foo/音楽.json"
// desired url.path: "foo/%E9%9F%B3%E6%A5%BD.json"

Note the query and fragment properties return their values in escaped form.

The SPDY spec says the ":path" header value must be a valid conforming URL, which means it should be percent-escaped. This change is the best fix I could find for all iOS clients. iOS 7+ has a NSURLComponents class that makes all of this much easier and more explicit.