[OGo-Developer] NSURL different in libFoundation and GNUstep base?

Sebastian Reitenbach developer@opengroupware.org
Mon, 14 Apr 2008 07:15:30 +0200


developer@opengroupware.org wrote: 
> On 13.04.2008, at 16:41, Sebastian Reitenbach wrote:
> >> lF itself has no HTTP support. You can use WOHTTPConnection,
> >> WORequest, WOResponse.
> > what a mess, then i need to look at these classes...
> 
> The HTTP API of Foundation was reworked quite a few times, the WO  
> classes have always been the most stable option.
Ah, OK.

> 
> >> Because your escaping code is b0rked. You escape almost the whole  
> >> URL:
> >>
> >>  URLString = [URLString stringByEscapingURL];
> >>  URLString = [@"http://" stringByAppendingString:URLString];
> >>
> >> How is that supposed to work? (you put everything in the  
> >> hostname ...)
> > at least that stringByAddingPercentEscapesUsingEncoding worked for  
> > me on the
> > whole uri string in gnustep-base, I did assume something equivalent  
> > happen
> > with stringByEscapingURL.
> 
> This would be a major bug in GNUstep, which is quite unlikely. As  
> mentioned the whole approach is utterly wrong. It is more likely that  
> stringByAddingPercentEscapesUsingEncoding only encodes a subset and is  
> not a proper URL fragment encoder.
The gnustep documentation to the method implementation starts this way:
/**
 * Constructs a new ASCII string which is a representation of the receiver
 * in which characters are escaped where necessary in order to produce a
 * legal URL.<br />

> 
> > so I just added the stringByAddingPercentEscapesUsingEncoding to
> > NSString+URLEscaping.m. (cut 'n paste from gnustep), works now on  
> > the whole
> > string, the same way as in gnustep ;).
> 
> It does not really work.
> 
> > I could also add the stringByReplacingPercentEscapesUsingEncoding,  
> > and then
> > open an enhancement request, including a patch. As both libraries have
> > compatible licenses, I think that shouldn't be too much a problem.
> > However, in gnustep-base, these methods are found in NSString.m,  
> > where would
> > be the best place in libFoundation?
> 
> libFoundation is BSD license, we can't include GS code. If you want to  
> write portable code, just use the methods provided by NGExtensions.  
File where I added the stringByReplacingPercentEscapesUsingEncoding method 
was in sope-core/NGExtensions/NGExtensions. Are these the NGExtensions you 
are talking about? Then 'd say, its SOPE stuff, not libFoundation, at least 
the files below there had the LGPL header.

> They also do the proper thing.
OK, I'll take a look there.

thanks
Sebastian