On 2010-09-10 06:44:10 +0900, Tanaka Akira wrote:
> 2010/9/8 Adam Majer <redmine / ruby-lang.org>:
> > Issue #3788 has been updated by Adam Majer.
> 
> > In my opinion, adding dnssafehost to URI is bad design.
> 
> I think adding a method is a good design.
> 
> > My expectation was that URI.host should return unescaped hostname/IP
> > and URI.host= should take unescaped as argument and escape them to
> > produce a valid URI. This interface could then be easily extended to
> > work with IRI (International domains).
> >
> >
> > maybe the solution is to rename current members host and host= to
> > host_rfc3986 and host_rfc3986=. Similar syntax already exists in
> > other classes like Time.
> 
> It introduces an incompatibility.
> Also, the primitive method to get/set the host part will be version dependent.
> 
> I think adding a new method for deal brackets is better.

doesnt that mean you will need to fix all of the users of the function?
with my net/http example above you can somewhat control it.

but e.g. ruby -r open-uri 'p open("http://[::1]:8080/test/test")'
doesnt give me control over which function is used.

i think the better approach might be to let url.host return "::1".
and just encode it when constructing a new url.

another option might be monkeypatching the string object returned by
url.host and add a "dnssafe" method like shown in the msdn article.

then the resolv class could get the dnssafe version when needed. but it
still might lead to trouble when the hostname is passed to other C
extensions.

    darix

-- 
           openSUSE - SUSE Linux is my linux
               openSUSE is good for you
                   www.opensuse.org