rack/rack — Issue #337: invalid %-encoding error in application for malformed uri
Author: StefanH
Created: 2012-02-01 16:49:24+00:00
State: open

When you go to, for example, `/foo?%9g` in my (rails) app, rack raises an `ArgumentError: invalid %-encoding`. I would expect to get a `400 Bad request` back.

The offending line is:

```ruby
URI.decode_www_form_component(s, encoding)
```

in rack/utils.rb line 39, wich tries to decode this invalid url component.

I'm using Nginx with passenger as a webserver. I've tried Rack versions 1.4.1 and 1.3.6.

Interestingly, when I go to `/%9g` (i.e. use `%9g` as part of the URI instead of passing it as a parameter), I immediately get a `400 Bad request` from nginx. Webrick returns a 400 either way. I'm not sure if nginx is correct in ignoring the invalid URI component and passing this request off to the app, but it would be nice if rack could handle it either way.