curl-library
Re: liberal or strict?
Date: Mon, 23 Apr 2012 20:55:44 +0200
On Mon, Apr 23, 2012 at 08:18:44PM +0200, Daniel Stenberg wrote:
> Hi friends,
> 
> Over in the Debian bug tracker for curl someone figured out that
> libcurl no longer supports illegally formatted URLs in this style:
> 
>  "2a02:1788:4fd:cd::c742:cde2"
> 
> or even like this:
> 
>  "http://2a02:1788:4fd:cd::c742:cde2/index.html"
> 
> (libcurl 7.25.0 cuts off the address from the last colon, thinking
> it is a port number)
> 
> A correct syntax would enclose the numerical IPv6 address within
> [brackets] like:
> 
>  "http://[2a02:1788:4fd:cd::c742:cde2]/index.html
> 
> I think we have two choices:
> 
> 1 - detect the address in the illegal URL and attempt to work with it
> 
> 2 - detect the illegal URL and refuse to work with it since it is badly
>     formatted
> 
> ABI wise we should be safe either way since we have no contract to
> support illegal URLs.
> 
> A few years ago I would have picked option (1) without hesitation,
> but now I'm hesitant and think that perhaps (2) is better as it will
> help applications and users to properly and quickly detect bad input
> and allow it to be fixed rather than to hide the error by allowing
> it and try to work with it and risk and we still fail somehow...
> 
> Opinions?
What about option (2) with an additional "--allow-invalid-url" (and equivalent
libcurl) option? (if that's possible at all, of course)
Cheers
-- 
perl -E '$_=q;$/= @{[@_]};and s;\S+;<inidehG ordnasselA>;eg;say~~reverse'
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
- application/pgp-signature attachment: Digital signature