# \_ in URI subdomain problem

**URL:** <https://www.ruby-forum.com/t/in-uri-subdomain-problem/64604>\
**Category:** Ruby\
**Created:** [August 15, 2006, 1:22am UTC](https://www.ruby-forum.com/t/in-uri-subdomain-problem/64604 "2006-08-15T01:22:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![varac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/c2a13f/32.png) [@varac](https://www.ruby-forum.com/u/varac)\
**Post date:** [August 15, 2006, 1:22am UTC](https://www.ruby-forum.com/t/in-uri-subdomain-problem/64604/1 "2006-08-15T01:22:12Z")

</div>

Hi,

I am currently working with some code for fetching webpages, and I have  
run into a problem. The current implementation does not fetch webpages  
with \_ in the subdomain, for ex http://a\_b.google.com.

I have poked around the forum posts and read that the \_ in the subdomain  
violates an RFC standand, but in my case it is necessary to retrieve  
those pages regardless. Before I dive a bit more into this code that I  
inherited, has anyone successfully retrieved such pages?

The code uses URI.parse for URI parsing and Net::HTTP for page  
retrieval. Currently the code breaks at the URI.parse. Will it suffice  
just to rewrite the URI.parse or do I need to find an alternative to  
Net::HTTP as well?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![varac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/c2a13f/32.png) [@varac](https://www.ruby-forum.com/u/varac)\
**Post date:** [August 15, 2006, 2:20pm UTC](https://www.ruby-forum.com/t/in-uri-subdomain-problem/64604/2 "2006-08-15T14:20:29Z")

</div>

> The code uses URI.parse for URI parsing and Net::HTTP for page  
> retrieval. Currently the code breaks at the URI.parse. Will it suffice  
> just to rewrite the URI.parse or do I need to find an alternative to  
> Net::HTTP as well?

Should be able to extend URI.parse and have it work there. Good luck!

---

<div class="post-metadata">

**Author:** ![varac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/c2a13f/32.png) [@varac](https://www.ruby-forum.com/u/varac)\
**Post date:** [August 15, 2006, 7:52pm UTC](https://www.ruby-forum.com/t/in-uri-subdomain-problem/64604/3 "2006-08-15T19:52:15Z")

</div>

I think I found the answer in URI.escape after discovering the goldmine  
that is the searchable Ruby list.

[http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml#ruby\_talk](http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml#ruby_talk)

Aredridel wrote:

> > The code uses URI.parse for URI parsing and Net::HTTP for page  
> > retrieval. Currently the code breaks at the URI.parse. Will it suffice  
> > just to rewrite the URI.parse or do I need to find an alternative to  
> > Net::HTTP as well?
> 
> Should be able to extend URI.parse and have it work there. Good luck!
