Fix error with Location header

This commit is contained in:
Richard Frith-Macdonald 2017-08-21 11:25:44 +01:00
parent bc285396da
commit f170693bca
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2017-08-21 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSURLProtocol.m: Fixed error where the presence of a
Location error was taken to indicate a redirect rather than looking
at the HTTP status code for a 3xx value.
2017-07-10 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/GSString.m (lengthUTF8):

View file

@ -1051,11 +1051,17 @@ static NSURLProtocol *placeholder = nil;
* until the challenge is complete, then try to deal with it.
*/
}
else if ((s = [[document headerNamed: @"location"] value]) != nil)
else if (_statusCode >= 300 && _statusCode < 400)
{
NSURL *url;
url = [NSURL URLWithString: s];
NS_DURING
s = [[document headerNamed: @"location"] value];
url = [NSURL URLWithString: s];
NS_HANDLER
url = nil;
NS_ENDHANDLER
if (url == nil)
{
NSError *e;