From: "Bradley, Todd" Date: 2004-11-02T01:20:50+09:00 Subject: Re: is this an open-uri bug? > It seems that the URI is redirected to invalid URI. That's what I guessed at first, but when I open that URI in either Firefox or IE, it works fine. Is this a case where the web browsers interpret the invalid URI, but open-uri will not? When I open that URI in Firefox, I get redirected to http://www.infospace.com/home/white-pages/message.htm?kcfg=wpus&otmpl=%2 Fwhite-pages%2Fresults.htm&qfm=n&qk=10&top=1&qname=Bubba+Ray+Jackson&qf= Bubba&qn=Ray&qs=co&searchtype=citystate&qn=Jackson&qf=Bubba%20Ray&qc=Bro omfield&MessageType=NoResults which is a valid URI. Todd. > > % ./ruby -ropen-uri -e ' > class << URI > alias org_parse parse > def parse(arg) > p arg > org_parse(arg) > end > end > open("http://www.infospace.com/home/redirect.htm?formfrom=qsea > rch&pgtarg=directory&wqhqn=2&qhqn=Bubba+Ray+Jackson&qc=Broomfi > eld&qs=co") > ' > "http://www.infospace.com/home/redirect.htm?formfrom=qsearch&p > gtarg=directory&wqhqn=2&qhqn=Bubba+Ray+Jackson&qc=Broomfield&qs=co" > "http://www.infospace.com/home/white-pages/validate.htm?kcfg=w > pus&otmpl=%2Fwhite-pages%2Fresults.htm&qfm=n&qk=10&top=1&qname > =Bubba+Ray+Jackson&qf=Bubba&qn=Ray&qc=Broomfield&qs=co" > "http://kevdb.infospace.com/home/white-pages/kevdb?kcfg=wpus&o > tmpl=%2Fwhite-pages%2Fresults.htm&qfm=n&qk=10&top=1&qname=Bubb a+Ray+Jackson&qf=Bubba&qn=Ray&qs=co&searchtype=citystate&QN=Jackson&QF=B ubba Ray&qc=Broomfield" > /home/akr/ruby/tmp-ruby/1.8/lib/ruby/1.8/uri/common.rb:432:in > `split': bad URI(is not URI?): > http://kevdb.infospace.com/home/white-pages/kevdb?kcfg=wpus&ot > mpl=%2Fwhite-pages%2Fresults.htm&qfm=n&qk=10&top=1&qname=Bubba +Ray+Jackson&qf=Bubba&qn=Ray&qs=co&searchtype=citystate&QN=Jackson&QF=Bu bba Ray&qc=Broomfield (URI::InvalidURIError) > from > /home/akr/ruby/tmp-ruby/1.8/lib/ruby/1.8/uri/common.rb:481:in > `org_parse' > from -e:6:in `parse' > from > /home/akr/ruby/tmp-ruby/1.8/lib/ruby/1.8/open-uri.rb:572:in > `proxy_open' > from > /home/akr/ruby/tmp-ruby/1.8/lib/ruby/1.8/open-uri.rb:525:in > `direct_open' > from > /home/akr/ruby/tmp-ruby/1.8/lib/ruby/1.8/open-uri.rb:169:in > `open_loop' > from > /home/akr/ruby/tmp-ruby/1.8/lib/ruby/1.8/open-uri.rb:164:in `catch' > from > /home/akr/ruby/tmp-ruby/1.8/lib/ruby/1.8/open-uri.rb:164:in > `open_loop' > from > /home/akr/ruby/tmp-ruby/1.8/lib/ruby/1.8/open-uri.rb:134:in `open_uri' > from > /home/akr/ruby/tmp-ruby/1.8/lib/ruby/1.8/open-uri.rb:424:in `open' > from > /home/akr/ruby/tmp-ruby/1.8/lib/ruby/1.8/open-uri.rb:85:in `open' > from -e:9 > > Since the last URI > > http://kevdb.infospace.com/home/white-pages/kevdb?kcfg=wpus&ot > mpl=%2Fwhite-pages%2Fresults.htm&qfm=n&qk=10&top=1&qname=Bubba +Ray+Jackson&qf=Bubba&qn=Ray&qs=co&searchtype=citystate&QN=Jackson&QF=Bu bba Ray&qc=Broomfield contains a space, URI.parse > fails. > -- > Tanaka Akira >