cURL / Mailing Lists / curl-library / Single Mail

curl-library

liberal or strict?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 23 Apr 2012 20:18:44 +0200 (CEST)

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?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-23