Hi,

> If you can shoe-horn your problem into Mechanize, it's got a private 
> method WWW::Mechanize#to_absolute_uri, which does precisely this.  Don't 
> know if that's of any use, but it might be worthwhile looking at how 
> it's implemented at least.

+1 for Alex's solution.

I have tried to implement this in scRUBYt! (I did not know Mechanize's 
to_absolute_uri back then) and, well, failed (fortunately I discovered 
it in Mechanize since then). My solution worked for 99% of the cases, 
but the rest was totally PITA to hunt down. I believe Aaron and the 
mechanize community already did this, so why reinvent the wheel?
Believe me, if you can shoe-horn it into Mechanize as Alex suggested, do 
it - it will save you lot of time, nerves, headaches, money, whatnot.

Cheers,
Peter
_
http://www.rubyrailways.com :: Ruby and Web2.0 blog
http://scrubyt.org :: Ruby web scraping framework
http://rubykitchensink.ca/ :: The indexed archive of all things Ruby.