------art_26432_666692.1190126849167
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 9/16/07, ruby-core-admin / ruby-lang.org <ruby-core-admin / ruby-lang.org>
wrote:
>
>
>
> ---------- Forwarded message ----------
> From: Eric Hodel <drbrain / segment7.net>
> To: ruby-core / ruby-lang.org
> Date: Sun, 16 Sep 2007 14:50:42 +0900
> Subject: Re: Misleading error message with URI::InvalidURIError
> On Sep 15, 2007, at 08:38, Douglas Tan wrote:
>
> > The error message that URI.parse displays when supplied with a uri
> > containing leading/trailing whitespace is misleading.
> >
> > irb(main):001:0> require 'uri'
> > true
> > irb(main):002:0> URI.parse(' http://www.ruby-lang.org ')
> > URI::InvalidURIError: bad URI(is not URI?): http://www.ruby-lang.org
> >         from /opt/local/lib/ruby/1.8/uri/common.rb:436:in `split'
> >         from /opt/local/lib/ruby/1.8/uri/common.rb:485:in `parse'
> >         from (irb):2
> >         from :0
> >
> > I believe that URI.split has an undocumented precondition on the
> > uri parameter, that it should not contain any whitespace around it.
> > Would a documentation patch be a good idea? Possibly even patching
> > URI.split to match enclosing space(es)?
>
> " http" is not a valid URI scheme, and "org " is not a valid TLD.  I
> don't think there's anything to fix here.
>
> --
> Poor workers blame their tools. Good workers build better tools. The
> best workers get their tools to do the work for them. -- Syndicate Wars
>
>
>
>
>
> ---------- Forwarded message ----------
> From: "Wilson Bilkovich" <wilsonb / gmail.com>
> To: ruby-core / ruby-lang.org
> Date: Sun, 16 Sep 2007 15:10:10 +0900
> Subject: Re: Misleading error message with URI::InvalidURIError
> On 9/16/07, Eric Hodel <drbrain / segment7.net> wrote:
> > On Sep 15, 2007, at 08:38, Douglas Tan wrote:
> >
> > > The error message that URI.parse displays when supplied with a uri
> > > containing leading/trailing whitespace is misleading.
> > >
> > > irb(main):001:0> require 'uri'
> > > true
> > > irb(main):002:0> URI.parse(' http://www.ruby-lang.org ')
> > > URI::InvalidURIError: bad URI(is not URI?): http://www.ruby-lang.org
> > >         from /opt/local/lib/ruby/1.8/uri/common.rb:436:in `split'
> > >         from /opt/local/lib/ruby/1.8/uri/common.rb:485:in `parse'
> > >         from (irb):2
> > >         from :0
> > >
> > > I believe that URI.split has an undocumented precondition on the
> > > uri parameter, that it should not contain any whitespace around it.
> > > Would a documentation patch be a good idea? Possibly even patching
> > > URI.split to match enclosing space(es)?
> >
> > " http" is not a valid URI scheme, and "org " is not a valid TLD.  I
> > don't think there's anything to fix here.
> >
>
> It would be nice if the error message called 'inspect' on the string,
> though.
> I ran into this the other day with a stray newline character on a URI,
> and I had to add some inspects to figure it out.
>
>
>
Yes, it would be a good idea to make the error in the URI more explicit.

-- 
Practical_Guile << http://practicalguile.com
Clever::Tagline::Pending

------art_26432_666692.1190126849167
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<br><br><div><span classmail_quote">On 9/16/07, <b classmail_sendername"><a hrefailto:ruby-core-admin / ruby-lang.org">ruby-core-admin / ruby-lang.org</a></b> &lt;<a hrefailto:ruby-core-admin / ruby-lang.org">ruby-core-admin / ruby-lang.org
</a>&gt; wrote:</span><blockquote classmail_quote" styleorder-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><br>---------- Forwarded message ----------<br>From: Eric Hodel &lt;
<a hrefailto:drbrain / segment7.net">drbrain / segment7.net</a>&gt;<br>To: <a hrefailto:ruby-core / ruby-lang.org">ruby-core / ruby-lang.org</a><br>Date: Sun, 16 Sep 2007 14:50:42 +0900<br>Subject: Re: Misleading error message with URI::InvalidURIError
<br>On Sep 15, 2007, at 08:38, Douglas Tan wrote:<br><br>&gt; The error message that URI.parse displays when supplied with a uri<br>&gt; containing leading/trailing whitespace is misleading.<br>&gt;<br>&gt; irb(main):001:0&gt; require &#39;uri&#39;
<br>&gt; t; true<br>&gt; irb(main):002:0&gt; URI.parse(&#39; <a hrefttp://www.ruby-lang.org">http://www.ruby-lang.org</a> &#39;)<br>&gt; URI::InvalidURIError: bad URI(is not URI?): <a hrefttp://www.ruby-lang.org">
http://www.ruby-lang.org</a><br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/local/lib/ruby/1.8/uri/common.rb:436:in `split&#39;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/local/lib/ruby/1.8/uri/common.rb:485:in `parse&#39;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from (irb):2<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from :0
<br>&gt;<br>&gt; I believe that URI.split has an undocumented precondition on the<br>&gt; uri parameter, that it should not contain any whitespace around it.<br>&gt; Would a documentation patch be a good idea? Possibly even patching
<br>&gt; URI.split to match enclosing space(es)?<br><br>&quot; http&quot; is not a valid URI scheme, and &quot;org &quot; is not a valid TLD.&nbsp;&nbsp;I<br>don&#39;t think there&#39;s anything to fix here.<br><br>--<br>Poor workers blame their tools. Good workers build better tools. The
<br>best workers get their tools to do the work for them. -- Syndicate Wars<br><br><br><br><br><br>---------- Forwarded message ----------<br>From: &quot;Wilson Bilkovich&quot; &lt;<a hrefailto:wilsonb / gmail.com">wilsonb / gmail.com
</a>&gt;<br>To: <a hrefailto:ruby-core / ruby-lang.org">ruby-core / ruby-lang.org</a><br>Date: Sun, 16 Sep 2007 15:10:10 +0900<br>Subject: Re: Misleading error message with URI::InvalidURIError<br>On 9/16/07, Eric Hodel &lt;
<a hrefailto:drbrain / segment7.net">drbrain / segment7.net</a>&gt; wrote:<br>&gt; On Sep 15, 2007, at 08:38, Douglas Tan wrote:<br>&gt;<br>&gt; &gt; The error message that URI.parse displays when supplied with a uri<br>&gt; &gt; containing leading/trailing whitespace is misleading.
<br>&gt; &gt;<br>&gt; &gt; irb(main):001:0&gt; require &#39;uri&#39;<br>&gt; &gt; t; true<br>&gt; &gt; irb(main):002:0&gt; URI.parse(&#39; <a hrefttp://www.ruby-lang.org">http://www.ruby-lang.org</a> &#39;)<br>&gt; &gt; URI::InvalidURIError: bad URI(is not URI?): 
<a hrefttp://www.ruby-lang.org">http://www.ruby-lang.org</a><br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/local/lib/ruby/1.8/uri/common.rb:436:in `split&#39;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /opt/local/lib/ruby/1.8/uri/common.rb:485:in `parse&#39;
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from (irb):2<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from :0<br>&gt; &gt;<br>&gt; &gt; I believe that URI.split has an undocumented precondition on the<br>&gt; &gt; uri parameter, that it should not contain any whitespace around it.
<br>&gt; &gt; Would a documentation patch be a good idea? Possibly even patching<br>&gt; &gt; URI.split to match enclosing space(es)?<br>&gt;<br>&gt; &quot; http&quot; is not a valid URI scheme, and &quot;org &quot; is not a valid TLD.&nbsp;&nbsp;I
<br>&gt; don&#39;t think there&#39;s anything to fix here.<br>&gt;<br><br>It would be nice if the error message called &#39;inspect&#39; on the string, though.<br>I ran into this the other day with a stray newline character on a URI,
<br>and I had to add some inspects to figure it out.<br><br><br></blockquote></div><br>Yes, it would be a good idea to make the error in the URI more explicit.<br clear
ll"><br>-- <br>Practical_Guile &lt;&lt; <a hrefttp://practicalguile.com">
http://practicalguile.com</a><br>Clever::Tagline::Pending

------art_26432_666692.1190126849167--