httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r937378 - in /httpd/mod_fcgid/trunk: CHANGES-FCGID docs/manual/mod/mod_fcgid.xml modules/fcgid/mod_fcgid.c
Date Fri, 23 Apr 2010 17:04:40 GMT
Author: trawick
Date: Fri Apr 23 17:04:40 2010
New Revision: 937378

URL: http://svn.apache.org/viewvc?rev=937378&view=rev
Log:
FcgidPassHeader now maps header names to environment variable names
in the usual manner: The header name is converted to upper case and
is prefixed with HTTP_.  An additional environment variable is 
created with the legacy name.

PR: 48964
Solution suggested by: wrowe

Modified:
    httpd/mod_fcgid/trunk/CHANGES-FCGID
    httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml
    httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c

Modified: httpd/mod_fcgid/trunk/CHANGES-FCGID
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/CHANGES-FCGID?rev=937378&r1=937377&r2=937378&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] (original)
+++ httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] Fri Apr 23 17:04:40 2010
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with mod_fcgid 2.3.6
 
+  *) FcgidPassHeader now maps header names to environment variable names
+     in the usual manner: The header name is converted to upper case and
+     is prefixed with HTTP_.  An additional environment variable is 
+     created with the legacy name.  PR 48964.  [Jeff Trawick]
+
   *) Allow processes to be reused within multiple phases of a request
      by releasing them into the free list as soon as possible.
      [Chris Darroch]

Modified: httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml?rev=937378&r1=937377&r2=937378&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml (original)
+++ httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml Fri Apr 23 17:04:40 2010
@@ -937,9 +937,17 @@
     <usage>
       <p>This directive specifies the name of a request header which
       will be passed to the FastCGI application as an environment
-      variable.  The environment variable name will match the name 
-      specified on this directive, with hyphens converted to 
-      underscores, and no case conversion performed.</p>
+      variable.  The name of the environment variable is derived from
+      the value specified on this directive, as discussed below:</p>
+
+      <p>The legacy behavior is to use the value specified on this directive
+      as the environment variable name, converting hyphens to underscores.
+      No case conversion is performed.</p>
+
+      <p>Beginning with release 2.3.6-dev, an additional environment variable
+      is created.  The value specified on this directive is converted to 
+      upper case, prefixed with <code>HTTP_</code>, and hyphens are 
+      converted to underscores.</p>
 
       <note type="hint"><title>Note</title>
       <p>Most request headers are already available to the application

Modified: httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c?rev=937378&r1=937377&r2=937378&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c Fri Apr 23 17:04:40 2010
@@ -19,6 +19,7 @@
 #include "http_request.h"
 #include "http_protocol.h"
 #include "ap_mmn.h"
+#include "apr_lib.h"
 #include "apr_buckets.h"
 #include "apr_strings.h"
 #include "apr_thread_proc.h"
@@ -105,6 +106,32 @@ default_build_command(const char **cmd, 
     return APR_SUCCESS;
 }
 
+/* http2env stolen from util_script.c */
+static char *http2env(apr_pool_t *a, const char *w)
+{
+    char *res = (char *)apr_palloc(a, sizeof("HTTP_") + strlen(w));
+    char *cp = res;
+    char c;
+
+    *cp++ = 'H';
+    *cp++ = 'T';
+    *cp++ = 'T';
+    *cp++ = 'P';
+    *cp++ = '_';
+
+    while ((c = *w++) != 0) {
+        if (!apr_isalnum(c)) {
+            *cp++ = '_';
+        }
+        else {
+            *cp++ = apr_toupper(c);
+        }
+    }
+    *cp = 0;
+ 
+    return res;
+}
+
 static void fcgid_add_cgi_vars(request_rec * r)
 {
     apr_array_header_t *passheaders = get_pass_headers(r);
@@ -117,8 +144,15 @@ static void fcgid_add_cgi_vars(request_r
         for (i = 0; i < hdrcnt; i++, ++hdr) {
             const char *val = apr_table_get(r->headers_in, *hdr);
 
-            if (val)
+            if (val) {
+                /* no munging of header name to create envvar name;
+                 * consistent with legacy mod_fcgid behavior and mod_fastcgi
+                 * prior to 2.4.7
+                 */
                 apr_table_setn(r->subprocess_env, *hdr, val);
+                /* standard munging of header name (upcase, HTTP_, etc.) */
+                apr_table_setn(r->subprocess_env, http2env(r->pool, *hdr), val);
+            }
         }
     }
 



Mime
View raw message