Menu

#1164 decode and encode: inconsistent handling of line breaks

open
ncgi (23)
5
2009-09-18
2009-09-18
No

ncgi::encode (and http::formatQuery, for that matter) encodes "\n" as "%0d%0a". ncgi::decode decodes this sequence into "\r\n".

The result is that if a multi-line string is passed from a program to a CGI script that uses ncgi for dealing with the parameters, the CGI script doesn't see the same string the program intended to send it.

If implemented correctly, ncgi::encode and ncgi::decode should therefore be inverse operations, and the one to be adapted seems to be ncgi::decode.

Discussion