Error in ASIHTTPRequest when redirect to Location with space in URI #154

Open
Villy21 opened this Issue Mar 21, 2011 · 0 comments

Projects

None yet

1 participant

@Villy21
Villy21 commented Mar 21, 2011

According to rfc2616 when redirect by 302 Location must contain URI to new location.
when I get Location:"http://www.somehost.com/I Get New Url.html" redirect url set to nil and ASIHTTPRequest v1.8 return error.

Fix: In ASIHTTPRequest->readResponseHeaders
change
[self setRedirectURL:[[NSURL URLWithString:[responseHeaders valueForKey:@"Location"] relativeToURL:[self url]] absoluteURL]];
to
[self setRedirectURL:[[NSURL URLWithString:[[responseHeaders valueForKey:@"Location"] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding] relativeToURL:[self url]] absoluteURL]];

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