FCGX_GetParam - certain mutations OK?

Dean Banks <[email protected]> Mon, 10 Oct 2011 11:46:34 -0700
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hi All,

Reading the docs for FCGX_GetParam, the notes state "Caller must not 
mutate the result or retain it past the end of this request."

I understand why retaining the results past the end of the request is 
bad. However, I don't understand why it's not possible to perform 
certain mutations on the pointer returned by FCGX_GetParam().

For example, if I'm using FCGX_GetParam to return the query string from 
a request, I might want to URL decode the result.  Since URL decoding 
always results in a string that is the same length or shorter, it seems 
like this should be OK to run directly on the pointer returned by 
FCGX_GetParam.  The alternative is to make a copy of any field that 
requires any mutation (even those that would only end up being 
shorter).  Similarly, if I wanted to tokenize the query string, 
replacing certain chars with nulls ('\0') doesn't seem like it should 
cause problems.

In short,  since we're not mutating *envp, but rather substrings of it 
(that result in a string of equal or lesser length) it seems like 
FCGX_Finish should still properly free the resources and everything 
should be happy.  What am I missing?

Cheers,

Dean