Simplify and save a little memory

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25156 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-05-15 05:55:02 +00:00
parent 5739213461
commit 7e96cc51c3
2 changed files with 81 additions and 36 deletions

View file

@ -345,9 +345,55 @@ static NSURLProtocol *placeholder = nil;
NSLog(@"startLoading when load in progress");
return;
}
_isLoading = YES;
_complete = NO;
_debug = NO;
_debug = YES;
/* Perform a redirect if the path is empty.
* As per MacOs-X documentation.
*/
if ([[[this->request URL] path] length] == 0)
{
NSURLRequest *request;
NSString *s = [[this->request URL] absoluteString];
NSURL *url;
if ([s rangeOfString: @"?"].length > 0)
{
s = [s stringByReplacingString: @"?" withString: @"/?"];
}
else if ([s rangeOfString: @"#"].length > 0)
{
s = [s stringByReplacingString: @"#" withString: @"/#"];
}
else
{
s = [s stringByAppendingString: @"/"];
}
url = [NSURL URLWithString: s];
request = [NSURLRequest requestWithURL: url];
if (request == nil)
{
NSError *e;
e = [NSError errorWithDomain: @"Invalid redirect request"
code: 0
userInfo: nil];
[this->client URLProtocol: self
didFailWithError: e];
}
else
{
[this->client URLProtocol: self
wasRedirectedToRequest: request
redirectResponse: nil];
}
if (_isLoading == NO)
{
return;
}
}
if (0 && this->cachedResponse)
{