Properly parse the querystring.

The previous code wasn't properly parsing the querystring, including
urldecoding.