Bug in URI.parse?

G

Guest

------=_Part_15381_18446851.1131402543336
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hello all,


looking for the right place to post a bug, hope this is the right mailing
list :)

irb(main):003:0> URI.parse "
http://london_airport_transfers.hotels-london.co.uk/transfer.php"
URI::InvalidURIError: the scheme http does not accept registry part:
london_airport_transfers.hotels-london.co.uk <http://london.co.uk> (or bad
hostname?)
from /usr/local/lib/ruby/1.8/uri/generic.rb:194:in `initialize'
from /usr/local/lib/ruby/1.8/uri/http.rb:46:in `initialize'
from /usr/local/lib/ruby/1.8/uri/common.rb:484:in `parse'
from (irb):3

The address is valid, check yourself. I started looking at the code, but
cannot figure it out.


Please help!


Cheers

Hagen

------=_Part_15381_18446851.1131402543336--
 
E

Eric Hodel

looking for the right place to post a bug, hope this is the right
mailing
list :)

irb(main):003:0> URI.parse "
http://london_airport_transfers.hotels-london.co.uk/transfer.php"
URI::InvalidURIError: the scheme http does not accept registry part:
london_airport_transfers.hotels-london.co.uk <http://london.co.uk>
(or bad
hostname?)
from /usr/local/lib/ruby/1.8/uri/generic.rb:194:in `initialize'
from /usr/local/lib/ruby/1.8/uri/http.rb:46:in `initialize'
from /usr/local/lib/ruby/1.8/uri/common.rb:484:in `parse'
from (irb):3

The address is valid, check yourself. I started looking at the
code, but
cannot figure it out.

An _ is forbidden by RFC952.

If you still don't believe me, go try to register a domain with an _.
 
G

Guest

------=_Part_15866_24494955.1131404587381
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline



An _ is forbidden by RFC952.


Okay, so the address is not valid. But Firefox resolves it and there is a
webserver answering. I do want to access the URI from Ruby.

Any help on how to overload the URI class to accept URIs with _ greatly
appreciated.


Cheers

Hagen

------=_Part_15866_24494955.1131404587381--
 
A

Alex Fenton

URI.parse "http://london_airport_transfers.hotels-london.co.uk/transfer.php"
URI::InvalidURIError: the scheme http does not accept registry part:

It's an invalid URI - the "_" character is not permitted, only hyphens, numbers and letters. See RFC 1035

http://www.freesoft.org/CIE/RFC/1035/6.htm
The address is valid, check yourself.

It might be able to be created within the domain admin tool that you are using to create the subdomain, and it might work with some client software, but it will cause lots of problems for others. You should change alter the name to use hyphens or Ruby will only be the first of many problems ;)

a
 
G

Guest

------=_Part_16270_19540754.1131406443792
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
It might be able to be created within the domain admin tool that you are
using to create the subdomain, and it might work with some client softwar= e,
but it will cause lots of problems for others. You should change alter th= e
name to use hyphens or Ruby will only be the first of many problems ;)


I'm just writing a crawler and need to worry about Ruby knowing the RFC and
throwing an exception. What ever happend to Postel's Law?


Cheers

Hagen

------=_Part_16270_19540754.1131406443792--
 
E

Eric Hodel

I'm just writing a crawler and need to worry about Ruby knowing the
RFC and
throwing an exception. What ever happend to Postel's Law?

URI follows it perfectly.

It is your seatbelt on the sending side by not allowing you to send
bad DNS packets around the internet.

It is your seatbelt on the receiving side by giving you a decent
message when it encounters bad data allowing you to handle it
gracefully rather than breaking.
 
G

Guest

------=_Part_16702_3869296.1131409098859
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
It is your seatbelt on the receiving side by giving you a decent
message when it encounters bad data allowing you to handle it
gracefully rather than breaking.


I consider throwing an exception as breaking. As I said, Firefox just
renders the page, Ruby breaks. I'm willing to just overload URI with my
expected behavior, if someone gives me a hint on where to look (I started
and didn't see anything obvious).


Cheers

Hagen

------=_Part_16702_3869296.1131409098859--
 
A

Austin Ziegler

I consider throwing an exception as breaking. As I said, Firefox just
renders the page, Ruby breaks. I'm willing to just overload URI with my
expected behavior, if someone gives me a hint on where to look (I started
and didn't see anything obvious).

Don't overload. If you get an exception, rescue and see if the URI
contains _ -- which are illegal. Print a warning and silently convert
_ to - and retry.

-austin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top