mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-23 19:51:13 +00:00
Optimized based on Manuel's code.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@19529 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dafbed7200
commit
f87efed053
1 changed files with 53 additions and 15 deletions
|
@ -261,14 +261,20 @@ RCS_ID("$Id$")
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
- (unsigned) length
|
- (unsigned) length
|
||||||
{
|
{
|
||||||
[self _compose];
|
if (!_composed)
|
||||||
|
{
|
||||||
|
[self _compose];
|
||||||
|
}
|
||||||
return [_url length];
|
return [_url length];
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
- (unichar) characterAtIndex: (unsigned)index
|
- (unichar) characterAtIndex: (unsigned)index
|
||||||
{
|
{
|
||||||
[self _compose];
|
if (!_composed)
|
||||||
|
{
|
||||||
|
[self _compose];
|
||||||
|
}
|
||||||
return [_url characterAtIndex:index];
|
return [_url characterAtIndex:index];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -277,7 +283,10 @@ RCS_ID("$Id$")
|
||||||
withString: (NSString*)aString
|
withString: (NSString*)aString
|
||||||
{
|
{
|
||||||
LOGObjectFnStart();
|
LOGObjectFnStart();
|
||||||
[self _compose];
|
if (!_composed)
|
||||||
|
{
|
||||||
|
[self _compose];
|
||||||
|
}
|
||||||
[_url replaceCharactersInRange:range
|
[_url replaceCharactersInRange:range
|
||||||
withString:aString];
|
withString:aString];
|
||||||
LOGObjectFnStop();
|
LOGObjectFnStop();
|
||||||
|
@ -342,6 +351,7 @@ RCS_ID("$Id$")
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
@implementation GSWDynamicURLString (GSWDynamicURLStringParsing)
|
@implementation GSWDynamicURLString (GSWDynamicURLStringParsing)
|
||||||
|
|
||||||
-(void)_compose
|
-(void)_compose
|
||||||
{
|
{
|
||||||
if (!_composed)
|
if (!_composed)
|
||||||
|
@ -358,32 +368,60 @@ RCS_ID("$Id$")
|
||||||
if (_protocol)
|
if (_protocol)
|
||||||
{
|
{
|
||||||
if (_host)
|
if (_host)
|
||||||
[_url appendFormat:@"%@://",_protocol];
|
{
|
||||||
|
[_url appendString:_protocol];
|
||||||
|
[_url appendString:@"://"];
|
||||||
|
}
|
||||||
else if (_port)
|
else if (_port)
|
||||||
[_url appendFormat:@"%@://localhost",_protocol];
|
{
|
||||||
|
[_url appendString:_protocol];
|
||||||
|
[_url appendString:@"://localhost"];
|
||||||
|
}
|
||||||
else if (_prefix)
|
else if (_prefix)
|
||||||
[_url appendFormat:@"%@:/",_protocol];
|
{
|
||||||
|
[_url appendString:_protocol];
|
||||||
|
[_url appendString:@":/"];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
[_url appendFormat:@"%@://",_protocol];
|
{
|
||||||
|
[_url appendString:_protocol];
|
||||||
|
[_url appendString:@"://"];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
if (_host)
|
if (_host)
|
||||||
[_url appendString:_host];
|
[_url appendString:_host];
|
||||||
if (_port)
|
if (_port)
|
||||||
[_url appendFormat:@":%d",_port];
|
{
|
||||||
|
[_url appendFormat:@":%d",_port];
|
||||||
|
};
|
||||||
if (_prefix)
|
if (_prefix)
|
||||||
[_url appendFormat:@"%@/",_prefix];
|
{
|
||||||
|
[_url appendString:_prefix];
|
||||||
|
[_url appendString:@"/"];
|
||||||
|
};
|
||||||
if (_applicationName)
|
if (_applicationName)
|
||||||
[_url appendFormat:@"%@.%@/",
|
{
|
||||||
_applicationName,
|
[_url appendString:_applicationName];
|
||||||
GSWApplicationSuffix[GSWebNamingConv]];
|
[_url appendString:@"."];
|
||||||
|
[_url appendString:GSWApplicationSuffix[GSWebNamingConv]];
|
||||||
|
[_url appendString:@"/"];
|
||||||
|
};
|
||||||
if (_applicationNumber>=0)
|
if (_applicationNumber>=0)
|
||||||
[_url appendFormat:@"%d/",_applicationNumber];
|
[_url appendFormat:@"%d/",_applicationNumber];
|
||||||
if (_requestHandlerKey)
|
if (_requestHandlerKey)
|
||||||
[_url appendFormat:@"%@/",_requestHandlerKey];
|
{
|
||||||
|
[_url appendString:_requestHandlerKey];
|
||||||
|
[_url appendString:@"/"];
|
||||||
|
};
|
||||||
if (_requestHandlerPath)
|
if (_requestHandlerPath)
|
||||||
[_url appendFormat:@"%@",_requestHandlerPath];
|
{
|
||||||
|
[_url appendString:_requestHandlerPath];
|
||||||
|
};
|
||||||
if (_queryString)
|
if (_queryString)
|
||||||
[_url appendFormat:@"?%@",_queryString];
|
{
|
||||||
|
[_url appendString:@"?"];
|
||||||
|
[_url appendString:_queryString];
|
||||||
|
};
|
||||||
NSDebugMLLog(@"low",@"url %@ class=%@",_url,[_url class]);
|
NSDebugMLLog(@"low",@"url %@ class=%@",_url,[_url class]);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue