dbalatero/typhoeus — pull request #127 by robgleeson (2011-11-17 13:44:05+00:00)
Title: If 'url' responds to #host, do not try to process it via URI.parse(…).

hey,

The URI library in the standard library has problems parsing URLs such as:

`http://udc.msn.com/c.gif?js=0&evt=impr&di=4138&pi=81944&ps=10223&su=http://ie.msn.com/default.aspx&pageid=8392946&mk=en-ie&pn=IE Homepage&br=MSFT&mv=V15&pp=False&rid=98c55b69089148d88e652d8d8f3fccc0`

Addressable::URI can parse those URLs fine, but Typhoeus does not give me any option on what URI parser I'd like to use. It will always pass the URL string onto URI.parse(…). I made a patch so that if 'url' responds to `#host`, it will skip trying to parse with URI.parse(…) and assume it is a URI-like object already.

This allows me to do:
`Typohoeus::Request.new Addressable::URI.parse("http://www.crazyurl.com/fdjdfd")`

From a quick look over the source, I found Typhoeus::Request is using URI-like objects to extract just the hostname, and does not call any other methods than `#host`.

Thanks,
Rob