[Web-SIG] URL quoting in WSGI (or the lack therof)

Sven Berkvens-Matthijsse sven at berkvens.net
Tue Jan 22 12:47:47 CET 2008


Luís Bruno wrote:
> Ian Bicking wrote:
> > But relating REQUEST_URI with SCRIPT_NAME/PATH_INFO is awkward and 
> > having the information in duplicate places can lead to errors and 
> > unclear situations if they don't match up properly.
> 
> True, and you can apply the same reasoning to my suggestion too.
> 
> Apart from the duplication of information, there's how or where to
> do the actual decoding. Not everyone is dispatching to a
> CherryPy-style tree of objects, so putting a %-decoded list of path
> segments in a environ key doesn't work -- I knew it was a bad idea!
> I'm going with CherryPy's on this: don't decode "%2F". Should other
> characters be kept encoded?

Yes, in my opinion all encoded character should remain encoded.
Otherwise, a path like /whatever/some%252Fthing/blah/ would become
(after decoding): /whatever/some%2Fthing/blah/ which is certainly not
what you'd want and/or expect.

> Also, this crystallizes my thoughts on the matter: %-decoding is the
> applications' job. Or frameworks'. *Not* the servers'.

I absolutely agree on this. The application is the only entity that
knows how to interpret the (remainder of the) URI properly.

> -- 
> Luís Bruno

-- 
het internet begint bij ilse            tel: 040 219 32 00
Sven Berkvens-Matthijsse                fax: 040 219 32 99
sven at ilse.net                           url: http://ilse.nl/


More information about the Web-SIG mailing list