# Is it a bug of URI lib?

**URL:** <https://www.ruby-forum.com/t/is-it-a-bug-of-uri-lib/110737>\
**Category:** Ruby\
**Created:** [July 30, 2007, 1:39pm UTC](https://www.ruby-forum.com/t/is-it-a-bug-of-uri-lib/110737 "2007-07-30T13:39:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nan\_wu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/73ab20/32.png) [@nan\_wu](https://www.ruby-forum.com/u/nan_wu)\
**Post date:** [July 30, 2007, 1:39pm UTC](https://www.ruby-forum.com/t/is-it-a-bug-of-uri-lib/110737/1 "2007-07-30T13:39:31Z")

</div>

I use the URI.merge method, and I met something incorrect. It is a bug  
of  
URI lib?

For example:

require ‘uri’

site\_url = ‘[http://www.try.com/test.aspx](http://www.try.com/test.aspx)’  
cur\_url =‘?page=2’

site=URI.parse(site\_url)

cur=URI.parse(cur\_url)

p farther.merge(cur)

The result:

#\<URI::HTTP:0x15bc060  
URL:[Minimal Grid Portfolio](http://www.try.com/?page=2)[http://www.try.com/?page=2](http://www.try.com/?page=2)

> 

But what I want is:

_[http://www.try.com/test.aspx?page=2](http://www.try.com/test.aspx?page=2)_

So I think this is a bug,because the ?page=2 is legal relative url in  
html.

---

<div class="post-metadata">

**Author:** ![nan\_wu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/73ab20/32.png) [@nan\_wu](https://www.ruby-forum.com/u/nan_wu)\
**Post date:** [July 30, 2007, 1:47pm UTC](https://www.ruby-forum.com/t/is-it-a-bug-of-uri-lib/110737/2 "2007-07-30T13:47:32Z")

</div>

nan wu wrote:

> site=URI.parse(site\_url)
> 
> _[http://www.try.com/test.aspx?page=2](http://www.try.com/test.aspx?page=2)_
> 
> So I think this is a bug,because the ?page=2 is legal relative url in html.

It’s legal under RFC 3986, but not under RFC 2396, as far as I know.  
The URI library is written to conform to the latter. There was a  
suggestion a little while ago to update it, but I don’t know that  
anything came of it. If I had the time I’d do it myself, but I’m under  
the gun at the moment.

---

<div class="post-metadata">

**Author:** ![nan\_wu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/73ab20/32.png) [@nan\_wu](https://www.ruby-forum.com/u/nan_wu)\
**Post date:** [July 30, 2007, 1:57pm UTC](https://www.ruby-forum.com/t/is-it-a-bug-of-uri-lib/110737/3 "2007-07-30T13:57:34Z")

</div>

Maybe I should report it to the Akira Yamada the original author of URI  
lib.  
The URI lib should be updated since we will meet many cases like that  
with  
RFC 3986.

I have checked the source codes of URI lib. I found it completely follow  
the  
RFC 2396.

2007/7/30, Alex Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
