In implementing OAuth2 in my app, I need to handle URIs like:
http://localhost:3000/sessions/create/?code=lorem|ipsum
Not sure if it's a Rails 3 or Ruby 1.9.2 problem (maybe URI.parse), but in any event, WEBrick kicks Error bad URI
.
Anyone know of a workaround? Thanks.
The initializer worked, but I ended up using URI.escape instead as it seemed cleaner and looks like it will handle more cases.
Plus this code just didnt seem right
I ended up just swapping in Thin for WEBrick and haven't had issues.
I ran into the same requirement (and problem) recently. On Rails 3 and Ruby 1.9.2.
It is not a problem for our staging/production environment (nginx), but I was interested to find out what the problem was with WEBrick. Turns out the issue is down in the URI::Parser.split method, specifically how it's pattern matching is seeded with the URI::REGEXP::PATTERN constants.
You can "fix" this by adding the following to a config/environments/development.rb (assuming you'd only be using WEBrick in dev .. or you could put it in a config/initializers file)..
NB: that's setting :UNRESERVED => "-_.!~*'()a-zA-Z\d|"