Addressable

Installation:

sudo apt-get install libidn11-dev
sudo gem install idn addressable

Usage:

require 'addressable/uri'

# URI Templates
uri = Addressable::URI.expand_template("http://example.com/?q={query}", {
 "query" => "an example query"
})
puts uri
http://example.com/?q=an%20example%20query

# heuristic_parse / normalize
uri = Addressable::URI.heuristic_parse('http:///example.com/"')
puts uri.normalize
http://example.com/%22

# extract_mapping
uri = Addressable::URI.parse('http://intertwingly.net/blog/2007/12/21/foo')
p uri.extract_mapping('http://{host}/blog/{date}/{slug}')
{"slug"=>"foo", "date"=>"2007/12/21", "host"=>"intertwingly.net"}

# IRI
uri = Addressable::URI.parse("http://www.詹姆斯.com/")
puts uri.normalize
http://www.xn--8ws00zhy3a.com/


So, I don’t recognize the cool SVG icon?  Doesn’t seem to parse into easily recognizable characters either.

Posted by Bob Aman at

I actually don’t know the history of that icon.  From what I gather, it dates back to the *IETF* HTML Working Group, and still appears on the w3 protocols page.

Posted by Sam Ruby at

Sam Ruby: Addressable

[link]...

Excerpt from del.icio.us/tag/semweb at


The icon looks vaguely like “ID” for Internet Draft. But that doesn’t include the four boxes…

Offtopic: I can’t put my accented name (Hoàng Đức Hiếu) in the Name box, I got this page:

406 Not Acceptable

This request was blocked by mod_security.

Access denied with code 406. Error parsing cookies: Error normalising cookie value: Invalid URL encoding detected: invalid characters used [severity “EMERGENCY”]

If you are the owner of this domain, and believe this request should not have been blocked, please contact cornerhost support.

Live use case for Addressable::URI.normalize :)

Posted by Hieu Duc Hoang at

If you are the owner of this domain, and believe this request should not have been blocked, please contact cornerhost support.

done.  I’ll report back when I hear something.

Posted by Sam Ruby at

“Internet Draft” makes sense; the colors are those of the W3C logo at the time.

Wasn’t there another HTTP icon on those pages in those days?

Posted by Arien at


URI Templates in Ruby

Addressable is a replacement for the URI implementation that is part of Ruby’s standard library. It more closely conforms to the relevant RFCs and adds support for IRIs and URI templates. [via Sam Ruby]......

Excerpt from Stefan Tilkov's Random Stuff at


Rounded Corners - 179 (Stick figures)

Addressable. Bog Aman’s better URI library for Ruby (via Sam Ruby) Er.js. Erlang-style concurrency with JavaScript. (Mini-rant: I wish people would stop calling it Erlang-style, just give Erlang credit for popularizing and it’s...

Excerpt from Labnotes at


links for 2007-12-31

The Wisdom of Ganesh: Paying the RESTafarians Back in Their Own Coin One of the best anti-REST rant I’ve come across. Check out Steve Vinoski’s blog for a response (in short, it’s the constraints, stupid). (tags: blog post article critique REST...

Excerpt from Rafael rambling at

Add your comment












Nav Bar