Project

General

Profile

Actions

Bug #438

closed

mod_fastcgi strips numeric characters from setenv.add-environment variable names

Added by Anonymous almost 16 years ago. Updated about 15 years ago.

Status:
Fixed
Priority:
Normal
Category:
mod_fastcgi
Target version:
-
ASK QUESTIONS IN Forums:

Description

Any environment variable set with setenv.add-environment for a mod_fastcgi server has its environment variable name stripped of any non-alpha characters. This makes it impossible to pass PERL5LIB to a perl fastcgi script on a per-request basis.

To illustrate:


 "LAB01_CONTEXT_CONFIG" => "/app/run/Machine/conf/development.config",
 "PERL5LIB"             => "/app/run",

Those variables become {{{LAB@_CONTEXT_CONFIG@ and {{{PERL@PERL_LIB@, which they should not.

This patch (against 1.4.8, but it should apply cleanly to svn) fixes the problem:


--- mod_fastcgi.c.bak   2006-01-03 20:16:17.000000000 -0700
+++ mod_fastcgi.c       2006-01-03 20:13:41.000000000 -0700
@@ -1640,7 +1640,7 @@
                        buffer_prepare_append(srv->tmp_buf, ds->key->used + 2);
                        for (j = 0; j < ds->key->used - 1; j++) {
                                srv->tmp_buf->ptr[srv->tmp_buf->used++] = 
-                                       isalpha((unsigned char)ds->key->ptr[j]) ? 
+                                       isalnum((unsigned char)ds->key->ptr[j]) ? 
                                        toupper((unsigned char)ds->key->ptr[j]) : '_';
                        }
                        srv->tmp_buf->ptr[srv->tmp_buf->used++] = '\0';

(For convenience, i've copied the patch file to
http://sa.illuzionz.org/lighttpd-fastcgi-enfironment-fix.patch )

-- eyez

Actions #1

Updated by jan almost 16 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

fixed in r914

in the same run i replaced isalpha by light_isalpha as we don't want to include non ascii-chars or depend on the locale.

Actions

Also available in: Atom