mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-24 14:12:26 +00:00
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:
parent
5739213461
commit
7e96cc51c3
2 changed files with 81 additions and 36 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue