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

Villy21 opened this Issue Mar 21, 2011 · 0 comments


None yet

1 participant

Villy21 commented Mar 21, 2011

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

Fix: In ASIHTTPRequest->readResponseHeaders
[self setRedirectURL:[[NSURL URLWithString:[responseHeaders valueForKey:@"Location"] relativeToURL:[self url]] absoluteURL]];
[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