Fixed bug where an improperly encoded URI will cause a 500.

The strategy is to handle the URI syntax error, by attempting to
encode the URL. If that fails then we return a 400 to the client.
Merge pull request #216 from RackerWilliams/bad_url

Fixed bug where an improperly encoded URI will cause a 500.