tenderlove / the_metal

A spike for thoughts about Rack 2.0
518 stars 27 forks source link

Should Rack handle invalid URI's? or raise something other than ArgumentError? #8

Open bf4 opened 9 years ago

bf4 commented 9 years ago

e.g. https://gist.github.com/bf4/d26259acfa29f3b9882b

re: https://github.com/rack/rack/issues/337#issuecomment-46453404

# 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/