From xavier-list at rhnh.net Sun Oct 22 01:24:52 2006 From: xavier-list at rhnh.net (Xavier Shay) Date: Sun, 22 Oct 2006 15:24:52 +1000 Subject: [PATCH] Ugly rewrite and redirects Message-ID: <453B00A4.6060306@rhnh.net> Certain pages (GMail, for one), break when passed through Hpricot. It would be beneficial if one could prevent Hpricot parsing and work off the raw text. I call this "ugly_rewrite". Basically, if only ugly_rewrites are registered for a page, it will never be parsed by hpricot. Patch against r78: http://rhnh.svnrepository.com/svn/public/ruby/pgpirate/mousehole_ugly_patch_r78.diff Usage: http://rhnh.svnrepository.com/svn/public/ruby/pgpirate/ As soon as I figure out how to run mouseHole's test suite I'll also upload appropriate test coverage. (Getting following error: test_set_attr(TestParser): NoMethodError: undefined method `search' for # ./test/test_parser.rb:14:in `test_set_attr' ) Also in this patch is a small hack that will call the "redirect" method on a mouseHole script if it exists. This gives the script a chance to redirect a request to somewhere of its own choosing. Among the myriad of possibilities this facilitates, I'm using it to do AJAX requests from an arbitrary site to my camping app running on localhost without hitting any security restrictions. (Technically you can do this without redirects, but it requires a bogus URL to be sent to the remote server, and you can't do it with POSTs). QUESTION: How could I incorporate the existing syntax for urls? (+, -, ... * is pretty ugly). Don't really understand how this bit of meta-goodness works. Xavier http://rhnh.net