You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by mx...@apache.org on 2011/09/23 12:37:15 UTC

svn commit: r1174641 - in /tcl/rivet/branches/2.0: ChangeLog debian/changelog debian/rules src/apache-1/TclWebapache.c src/apache-1/rivetCore.c src/apache-2/rivetCore.c

Author: mxmanghi
Date: Fri Sep 23 10:37:15 2011
New Revision: 1174641

URL: http://svn.apache.org/viewvc?rev=1174641&view=rev
Log:
2011-09-23 Massimo Manghi <mx...@apache.org>
    * debian/rules,debian/changelog: new lintian required targets, current Debian package version bumped up to 2.0.4-1
    * src/apache-1/TclWebapache.c,src/apache-1/rivetCode.c: latest changes for 'makeurl', 'load_env' and 'load_headers'
    ported to code for Apache 1.x


Modified:
    tcl/rivet/branches/2.0/ChangeLog
    tcl/rivet/branches/2.0/debian/changelog
    tcl/rivet/branches/2.0/debian/rules
    tcl/rivet/branches/2.0/src/apache-1/TclWebapache.c
    tcl/rivet/branches/2.0/src/apache-1/rivetCore.c
    tcl/rivet/branches/2.0/src/apache-2/rivetCore.c

Modified: tcl/rivet/branches/2.0/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.0/ChangeLog?rev=1174641&r1=1174640&r2=1174641&view=diff
==============================================================================
--- tcl/rivet/branches/2.0/ChangeLog (original)
+++ tcl/rivet/branches/2.0/ChangeLog Fri Sep 23 10:37:15 2011
@@ -1,3 +1,8 @@
+2011-09-23 Massimo Manghi <mx...@apache.org>
+    * debian/rules,debian/changelog: new lintian required targets, current Debian package version bumped up to 2.0.4-1
+    * src/apache-1/TclWebapache.c,src/apache-1/rivetCode.c: latest changes for 'makeurl', 'load_env' and 'load_headers'
+    ported to code for Apache 1.x
+
 2011-09-21 Massimo Manghi <mx...@apache.org>
     * rivet/packages/calendar/calendar.tcl: fixed wrong conversion of month expressed as numeric string
 

Modified: tcl/rivet/branches/2.0/debian/changelog
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.0/debian/changelog?rev=1174641&r1=1174640&r2=1174641&view=diff
==============================================================================
--- tcl/rivet/branches/2.0/debian/changelog (original)
+++ tcl/rivet/branches/2.0/debian/changelog Fri Sep 23 10:37:15 2011
@@ -1,3 +1,9 @@
+libapache2-mod-rivet (2.0.4-1) unstable; urgency=low
+
+  * New release 2.0.4
+
+ -- Massimo Manghi <mx...@apache.org>  Wed, 21 Sep 2011 22:20:30 +0200
+
 libapache2-mod-rivet (2.0.3-2) unstable; urgency=low
 
   * Added installation targets for removing unneeded .la libtool files 

Modified: tcl/rivet/branches/2.0/debian/rules
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.0/debian/rules?rev=1174641&r1=1174640&r2=1174641&view=diff
==============================================================================
--- tcl/rivet/branches/2.0/debian/rules (original)
+++ tcl/rivet/branches/2.0/debian/rules Fri Sep 23 10:37:15 2011
@@ -28,8 +28,11 @@ clean: 
 	dh_auto_clean
 	dh_clean
 
+build: build-arch build-indep
 
-build: configure build-stamp
+build-arch: build-stamp
+
+build-indep: build-stamp
 
 build-stamp: configure-stamp
 	dh_testdir
@@ -37,8 +40,6 @@ build-stamp: configure-stamp
 	( cd doc; $(MAKE) docs )
 	touch build-stamp
 
-configure: configure-stamp
-
 configure-stamp:
 	dh_testdir
 	chmod +x ./configure
@@ -99,4 +100,4 @@ libapache2-mod-rivet-doc: build
 	dh_md5sums -p$@
 	dh_builddeb -p$@ 
 
-.PHONY: build build-stamp clean binary binary-indep binary-arch configure
+.PHONY: build build-stamp clean binary binary-indep binary-arch

Modified: tcl/rivet/branches/2.0/src/apache-1/TclWebapache.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.0/src/apache-1/TclWebapache.c?rev=1174641&r1=1174640&r2=1174641&view=diff
==============================================================================
--- tcl/rivet/branches/2.0/src/apache-1/TclWebapache.c (original)
+++ tcl/rivet/branches/2.0/src/apache-1/TclWebapache.c Fri Sep 23 10:37:15 2011
@@ -421,7 +421,17 @@ TclWeb_GetEnvVars(Tcl_Obj *envvar, TclWe
 	val = TclWeb_StringToUtfToObj(env[i].val, req);
 	Tcl_IncrRefCount(key);
 	Tcl_IncrRefCount(val);
-	Tcl_ObjSetVar2(req->interp, envvar, key, val, TCL_NAMESPACE_ONLY);
+
+    /* Variable scope resolution changed to default (flags: 0)
+     * to enable creation of the array in the caller's local scope.
+     * Default behavior (creation in the ::request namespace)
+     * is now more consistently constrained by fully qualifying
+     * the default array names (see rivetCore.c). This should fix
+     * Bug 48963 
+     */
+
+    Tcl_ObjSetVar2(req->interp, envvar, key, val, 0);	
+
  	Tcl_DecrRefCount(key);
 	Tcl_DecrRefCount(val);
     }
@@ -455,8 +465,11 @@ TclWeb_GetHeaderVars(Tcl_Obj *headersvar
 	val = TclWeb_StringToUtfToObj(hdrs[i].val, req);
 	Tcl_IncrRefCount(key);
 	Tcl_IncrRefCount(val);
-	Tcl_ObjSetVar2(req->interp, headersvar,
-		       key, val, TCL_NAMESPACE_ONLY);
+
+    /* See comment in TclWeb_GetEnvVars concerning Bug 48963*/
+
+    Tcl_ObjSetVar2(req->interp, headersvar, key, val, 0);
+
  	Tcl_DecrRefCount(key);
 	Tcl_DecrRefCount(val);
     }

Modified: tcl/rivet/branches/2.0/src/apache-1/rivetCore.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.0/src/apache-1/rivetCore.c?rev=1174641&r1=1174640&r2=1174641&view=diff
==============================================================================
--- tcl/rivet/branches/2.0/src/apache-1/rivetCore.c (original)
+++ tcl/rivet/branches/2.0/src/apache-1/rivetCore.c Fri Sep 23 10:37:15 2011
@@ -38,14 +38,15 @@
 #include <string.h>
 #include <apr_tables.h>
 #include <apr_errno.h>
+#include <apr_strings.h>
 
 #include "apache_request.h"
 #include "mod_rivet.h"
 #include "rivet.h"
 #include "TclWeb.h"
 
-#define ENV_ARRAY_NAME "env"
-#define HEADERS_ARRAY_NAME "headers"
+#define ENV_ARRAY_NAME     "::request::env"
+#define HEADERS_ARRAY_NAME "::request::headers"
 #define COOKIES_ARRAY_NAME "cookies"
 
 extern module rivet_module;
@@ -71,17 +72,64 @@ extern char* TclWeb_GetRawPost (TclWebRe
 
 TCL_CMD_HEADER( Rivet_MakeURL )
 {
-    Tcl_Obj *result = NULL;
-    rivet_interp_globals *globals = Tcl_GetAssocData(interp, "rivet", NULL);
+    Tcl_Obj*                result  = NULL;
+    rivet_interp_globals*   globals = Tcl_GetAssocData(interp,"rivet",NULL);
+    char*                   url_target_name;
+    int                     target_length;
 
-    if (objc != 2)
+    if (objc > 2)
     {
 	Tcl_WrongNumArgs(interp, 1, objv, "filename");
 	return TCL_ERROR;
     }
-    result = Tcl_NewObj();
-    TclWeb_MakeURL(result, Tcl_GetString(objv[1]), globals->req);
+
+    if (objc == 1)
+    {
+        url_target_name = TclWeb_GetEnvVar (globals->req,"SCRIPT_NAME");
+    }
+    else
+    {
+        url_target_name = Tcl_GetStringFromObj(objv[1],&target_length);
+
+        // we check the first character for a '/' (absolute path)
+        // If we are dealing with a relative path we prepend it with
+        // the SCRIPT_NAME environment variable
+
+        if (url_target_name[0] != '/')
+        {
+            /* relative path */
+            char* script_name = TclWeb_GetEnvVar (globals->req,"SCRIPT_NAME");
+            int   script_name_l = strlen(script_name);
+
+            // regardless the reason for SCRIPT_NAME being undefined we
+            // prevent a segfault and we revert the behavior of makeurl
+            // to the case of an absolute path
+
+            if (script_name_l > 0)
+            {
+                // script name may have the form of a directory path (and mod_rewrite 
+                // could have mapped it to a .tcl or .rvt script)
+                
+                if (script_name[script_name_l-1] == '/')
+                {
+                    url_target_name = apr_pstrcat(globals->req->req->pool,script_name,url_target_name,NULL);
+                }
+                else
+                {
+                    url_target_name = apr_pstrcat(globals->req->req->pool,script_name,"/",url_target_name,NULL);
+                }
+            }
+            else
+            {
+                url_target_name = apr_pstrcat(globals->req->req->pool,"/",url_target_name,NULL);
+            }
+        }
+    }
+
+    result = Tcl_NewObj();   
+    TclWeb_MakeURL(result, url_target_name, globals->req);
     Tcl_SetObjResult(interp, result);
+
     return TCL_OK;
 }
 

Modified: tcl/rivet/branches/2.0/src/apache-2/rivetCore.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.0/src/apache-2/rivetCore.c?rev=1174641&r1=1174640&r2=1174641&view=diff
==============================================================================
--- tcl/rivet/branches/2.0/src/apache-2/rivetCore.c (original)
+++ tcl/rivet/branches/2.0/src/apache-2/rivetCore.c Fri Sep 23 10:37:15 2011
@@ -34,10 +34,8 @@
 #include "http_log.h"
 #include "http_main.h"
 #include "util_script.h"
-//#include "http_conf_globals.h"
 #include "http_config.h"
 
-
 #include <tcl.h>
 #include <string.h>
 #include <stdio.h>



---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org