# Need help to understand URI

**URL:** <https://www.ruby-forum.com/t/need-help-to-understand-uri/175679>\
**Category:** Ruby\
**Created:** [September 17, 2009, 3:48pm UTC](https://www.ruby-forum.com/t/need-help-to-understand-uri/175679 "2009-09-17T15:48:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hunt\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b9e5f3/32.png) [@Hunt\_J](https://www.ruby-forum.com/u/Hunt_J)\
**Post date:** [September 17, 2009, 3:48pm UTC](https://www.ruby-forum.com/t/need-help-to-understand-uri/175679/1 "2009-09-17T15:48:22Z")

</div>

I’m trying to understand different parts of a URI.

URI#parse() uses URI#split(). But I don’t understand which  
component is which.

There are nine components.

scheme, userinfo, host, port,  
registry, path, opaque, query, fragment

I can guess some of the above.  
But I’m not sure about others.

I tracked down the variable @regexp[:ABS\_URI] and @regexp[:REL\_URI]  
in split(), but

scheme is http://, ssh://  
userinfo is matz:  
host is [exampe.com](http://exampe.com)  
port is :80  
registry (I have no idea)  
path is /path/to/file/or/dir (does this include file name as well?)  
opaque (I have no idea)  
query (?s=hello&?q=goodbye)

uri/common.rb has a bunch of Regexp constants, which I find it  
difficult to understand.

If you could give me a general help on the list above (e.g., if I’m  
wrong or missing something),  
I could play at [http://rubular.com/](http://rubular.com/) to play more with URI.

Any help would be appreciated.

Jon Hunt

---

<div class="post-metadata">

**Author:** ![Hunt\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b9e5f3/32.png) [@Hunt\_J](https://www.ruby-forum.com/u/Hunt_J)\
**Post date:** [September 17, 2009, 4:01pm UTC](https://www.ruby-forum.com/t/need-help-to-understand-uri/175679/2 "2009-09-17T16:01:50Z")

</div>

On Thu, Sep 17, 2009 at 6:47 AM, Hunt J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I’m trying to understand different parts of a URI.

RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax  
[http://www.ietf.org/rfc/rfc2396.txt](http://www.ietf.org/rfc/rfc2396.txt)

:: would probably be a good place to start 🙂

---

<div class="post-metadata">

**Author:** ![Hunt\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b9e5f3/32.png) [@Hunt\_J](https://www.ruby-forum.com/u/Hunt_J)\
**Post date:** [September 17, 2009, 4:11pm UTC](https://www.ruby-forum.com/t/need-help-to-understand-uri/175679/3 "2009-09-17T16:11:12Z")

</div>

On Thu, Sep 17, 2009 at 11:00 PM, Hassan S.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Thu, Sep 17, 2009 at 6:47 AM, Hunt J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I’m trying to understand different parts of a URI.
> 
> RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax  
> [http://www.ietf.org/rfc/rfc2396.txt](http://www.ietf.org/rfc/rfc2396.txt)
> 
> :: would probably be a good place to start 🙂

Looks very helpful.
