I know we don't want to see any "fancy" things in our printenv (as
they were already posted by various users over the last years), but every time I need to use a little CGI script for testing purposes I get annoyed by this really too weak printenv script. Sure, tables and other stuff should be not our business, but at least the script should be a little bit more robust and useful. What I disliked most is that I usually have great problems to easily find a variable (because the output is not sorted) and that various environment values totally destroy the optical view on the table as a whole (mainly too large values in $PATH and the nasty contents of SERVER_SIGNATURE). So here is my minimal change to at least fix these problems without introducing fancy or insecure stuff. Nevertheless feel free to back it out if you definitely dislike any changes to printenv at all. My changes are: 1. add a comment line to make it clear to the user that this is more or less just a silly _demo_ script (for those who don't have Perl as their secondary language beside their native language) 2. use content type text/plain instead of text/html to easily avoid printing problems with variables like SERVER_SIGNATURE which contains HTML code. This way we have to add extra escaping steps and the script remains small. 3. sort the variables lexicographically in the output! 4. make sure very large lines (usually from $PATH) do not destroy the total optical view on the table by cutting values and replacing the missing stuff with "[...]". 5. surround values with quotes to allow one to better recognize newlines (as in SERVER_SIGNATURE) and whitespaces and also print newlines as \n and " as \" for a more Shell- and C-style syntax. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@84150 13f79535-47bb-0310-9956-ffa450edef68
Please register or sign in to comment