You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jim Jagielski <ji...@jaguNET.com> on 2017/02/10 15:31:11 UTC

Re: svn commit: r1782419 - /httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c

related to this and

    http://svn.apache.org/viewvc?rev=1782482&view=rev

what exactly are we defining as the difference between unsetting
an envar and setting it as "empty"?

Re: svn commit: r1782419 - /httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c

Posted by Jacob Champion <ch...@gmail.com>.
On 02/10/2017 07:48 AM, Jim Jagielski wrote:
> But since these are envvars, does anyone really use them
> that way?

Hmm... that's actually kind of a tricky question to answer.

CGI/1.1 says that an empty value and a missing value are indistinguishable:

    This specification does not distinguish between zero-length (NULL)
    values and missing values.  For example, a script cannot distinguish
    between the two requests http://host/script and http: //host/script?
    as in both cases the QUERY_STRING meta-variable would be NULL.

That's kind of unfortunate, since there are at least two HTTP headers 
(Host and Accept-Encoding are the ones I found) where an empty value is 
not semantically equivalent to a missing one. Maybe there are some shell 
environments that can't tell the difference between an empty variable 
and a nonexistent one, so CGI had to follow suit?

It looks like (by inspection, haven't tested) PHP allows developers to 
distinguish between the two with getenv(), and PHP-FPM also 
distinguishes between missing and empty values when applying its fixups. 
(For example, an empty REDIRECT_URL will trigger the "old Apache" 
fixups, but they won't run if REDIRECT_URL is completely missing.) And 
of course, there are other shells and scripting environments that let 
you distinguish between the two.

I think that if we want this directive to be the "last resort" for weird 
FCGI compatibility issues, we need to allow both empty *and* unset 
variables.

> We don't want people to think that one can "unset"
> an envvar by casting it to "", which some people may think.
>
> I guess it's more a docco issue that anything :)

+1 to both points. I'll keep thinking about ways to document; Eric 
pointed out we need good examples here too.

--Jacob

Re: svn commit: r1782419 - /httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
But since these are envvars, does anyone really use them
that way? We don't want people to think that one can "unset"
an envvar by casting it to "", which some people may think.

I guess it's more a docco issue that anything :)

> On Feb 10, 2017, at 10:40 AM, Eric Covener <co...@gmail.com> wrote:
> 
> On Fri, Feb 10, 2017 at 10:31 AM, Jim Jagielski <ji...@jagunet.com> wrote:
>> related to this and
>> 
>>    http://svn.apache.org/viewvc?rev=1782482&view=rev
>> 
>> what exactly are we defining as the difference between unsetting
>> an envar and setting it as "empty"?
> 
> For me, empty ones show up in the sample fastcgi as a key with an
> empty value. Unset ones are just not there.
> 
>         'PATH_INFO2' => '',


Re: svn commit: r1782419 - /httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c

Posted by Eric Covener <co...@gmail.com>.
On Fri, Feb 10, 2017 at 10:31 AM, Jim Jagielski <ji...@jagunet.com> wrote:
> related to this and
>
>     http://svn.apache.org/viewvc?rev=1782482&view=rev
>
> what exactly are we defining as the difference between unsetting
> an envar and setting it as "empty"?

For me, empty ones show up in the sample fastcgi as a key with an
empty value. Unset ones are just not there.

         'PATH_INFO2' => '',