Question re: should this be rack's job
# config.ru
run ->(env) {
[ 200, { 'Content-Type' => 'text/html', }, [Rack::Request.new(env).params.inspect] ]
}
rackup
open http://localhost:9292/?utf8=%E2%9C%93&search=&page=2&commit=%u00ABscript%u00BBalert(209);%u00AB/script%u00BB
ArgumentError at /
invalid %-encoding (%u00ABscript%u00BBalert(209))
Ruby $HOME/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/uri/common.rb: in decode_www_form_component, line 898
Web GET localhost/
Would you argue that rackup is not an acceptable app server, then? If not, would you accept a PR to rescue the Argument error in rack, warn that it's the app server's job to fix the issue, and re-raise it?
edit: I forgot posted a similar comment in rack/rack#323 (comment)
I chose to force the error via Rack::Request.new(env).params even though I know the 'failure' is ultimately from the URI module, since I want to trigger the exception at the Rack level, which might be fixed at some point. There are some other monkey patches people have made, mentioned in those issues, e.g. https://gist.github.com/psychocandy/3130349