You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tcl.apache.org by mx...@apache.org on 2018/11/20 09:08:19 UTC

[tcl-rivet] branch master updated: fix bug #62926

This is an automated email from the ASF dual-hosted git repository.

mxmanghi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ab3eda  fix bug #62926
2ab3eda is described below

commit 2ab3eda3fa3a9ceb682a098fb44d4cc1d9bcc1d6
Author: Massimo Manghi <mx...@apache.org>
AuthorDate: Tue Nov 20 10:08:02 2018 +0100

    fix bug #62926
---
 ChangeLog                    |  6 ++++++
 doc/rivet.xml.in             | 24 ++++++++++++------------
 src/mod_rivet_ng/rivetCore.c | 23 ++++++++++++++++++++++-
 tests/fqrivet_var.tcl        | 40 ++++++++++++++++++++++++++++++++++++++++
 tests/post.test              | 23 +++++++++++++++++++++++
 5 files changed, 103 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 761a496..5c4ed63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-11-20 Massimo Manghi <mx...@apache.org>
+    * src/mod_rivet_ng/rivetCore.c: patching from 3.0 to fix bug #92926
+    * tests/post.rvt,fqrivet_var.tcl: add tests to prevent post and get
+    variables crosstalk (bug #92926)
+    * doc/rivet.xml.in: displaying full version associated to the manual
+
 2018-11-02 Massimo Manghi <mx...@apache.org>
     * src/mod_rivet_ng/mod_rivet.[c|h]: add macro RIVET_MPM_BRIDGE to
     compose rivet bridge names
diff --git a/doc/rivet.xml.in b/doc/rivet.xml.in
index cff925d..e24504e 100644
--- a/doc/rivet.xml.in
+++ b/doc/rivet.xml.in
@@ -35,22 +35,22 @@
     <!ENTITY asciiglyphs.xml       SYSTEM "xml/asciiglyphs.xml" >
     <!ENTITY lazybridge.xml        SYSTEM "xml/lazybridge.xml" >
     <!ENTITY formbroker.xml        SYSTEM "xml/formbroker.xml" >
-    <!ENTITY version	              "@INIT_VERSION@" >
+    <!ENTITY version	           "@INIT_VERSION@" >
     <!ENTITY fullversion           "@PACKAGE_VERSION@" >
-    <!ENTITY version2-series	     "2.0,2.1,2.2,2.3" >
-    <!ENTITY version2-generic	     "2.x" >
-    <!ENTITY version30		        "3.0" >
-    <!ENTITY version31		        "3.1" >
+    <!ENTITY version2-series	   "2.0,2.1,2.2,2.3" >
+    <!ENTITY version2-generic	   "2.x" >
+    <!ENTITY version30		       "3.0" >
+    <!ENTITY version31		       "3.1" >
     <!ENTITY tcltk-url             "http://www.tcl.tk/" >
     <!ENTITY apache-url            "http://httpd.apache.org" >
     <!ENTITY apachedoc-vhost       "https://httpd.apache.org/docs/2.4/vhosts" >
-    <!ENTITY apachedoc-mpm	        "https://httpd.apache.org/docs/2.4/mpm.html" >
-    <!ENTITY apachedoc-prefork	  "https://httpd.apache.org/docs/2.4/mod/prefork.html" >
-    <!ENTITY apachedoc-worker	     "https://httpd.apache.org/docs/2.4/mod/worker.html" >
-    <!ENTITY apachedoc-event	     "https://httpd.apache.org/docs/2.4/mod/event.html" >
-    <!ENTITY apachedoc-winnt		  "https://httpd.apache.org/docs/2.4/mod/mpm_winnt.html" >
+    <!ENTITY apachedoc-mpm	       "https://httpd.apache.org/docs/2.4/mpm.html" >
+    <!ENTITY apachedoc-prefork	   "https://httpd.apache.org/docs/2.4/mod/prefork.html" >
+    <!ENTITY apachedoc-worker	   "https://httpd.apache.org/docs/2.4/mod/worker.html" >
+    <!ENTITY apachedoc-event	   "https://httpd.apache.org/docs/2.4/mod/event.html" >
+    <!ENTITY apachedoc-winnt	   "https://httpd.apache.org/docs/2.4/mod/mpm_winnt.html" >
     <!ENTITY apachedoc-docroot     "https://httpd.apache.org/docs/2.4/mod/core.html#documentroot" >
-    <!ENTITY apachedoc-alias		  "https://httpd.apache.org/docs/2.4/mod/mod_alias.html" >
+    <!ENTITY apachedoc-alias	   "https://httpd.apache.org/docs/2.4/mod/mod_alias.html" >
     <!ENTITY apachedoc-rewrite     "https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html" >
     <!ENTITY apachedoc-perftuning  "https://httpd.apache.org/docs/2.4/misc/perf-tuning.html" >
 ]>
@@ -90,7 +90,7 @@
   	</articleinfo>
 
   	<para>
-    	This manual was generated on <?dbtimestamp format="A Y-m-d X" ?>
+    	This manual is released as part of Apache/Rivet &fullversion; (<?dbtimestamp format="A Y-m-d X" ?>).
   	</para>
 
 	<!-- Introduction -->
diff --git a/src/mod_rivet_ng/rivetCore.c b/src/mod_rivet_ng/rivetCore.c
index 7650cbe..fde7281 100644
--- a/src/mod_rivet_ng/rivetCore.c
+++ b/src/mod_rivet_ng/rivetCore.c
@@ -638,10 +638,11 @@ TCL_CMD_HEADER ( Rivet_LoadHeaders )
 TCL_CMD_HEADER ( Rivet_Var )
 {
     rivet_thread_private*   private;
-    char*                   cmd;
+    char*                   cmd; 
     char*                   command;
     Tcl_Obj*                result = NULL;
     int                     source;
+    register const char     *p;
 
     THREAD_PRIVATE_DATA(private)
     CHECK_REQUEST_REC(private,"::rivet::var,::rivet::var_post,::rivet::var_qs")
@@ -657,6 +658,26 @@ TCL_CMD_HEADER ( Rivet_Var )
     result = Tcl_NewObj();
 
     /* determine if var_qs, var_post or var was called */
+
+    /* first of all we have to skip the namespace string at the beginning of the command:
+     * 
+     * This fragment of code is taken from tcl 8.6.6 (tclNamesp.c) and it's part of the
+     * function implementing Tcl "namespace tail", as such it should be authoritative
+     * regarding the determination of the namespace stripped command name 
+     */
+
+    for (p = cmd;  *p != '\0';  p++) {
+	    /* empty body */
+    }
+    
+    while (--p > cmd) {
+        if ((*p == ':') && (*(p-1) == ':')) {
+            p++;			/* Just after the last "::" */
+            break;
+        }
+    }
+    cmd = p;
+
     if (!strcmp(cmd, "var_qs")) source = VAR_SRC_QUERYSTRING;
     else if (!strcmp(cmd, "var_post")) source = VAR_SRC_POST;
     else source = VAR_SRC_ALL;
diff --git a/tests/fqrivet_var.tcl b/tests/fqrivet_var.tcl
new file mode 100644
index 0000000..8a5eedf
--- /dev/null
+++ b/tests/fqrivet_var.tcl
@@ -0,0 +1,40 @@
+switch [::rivet::var_qs get t1] {
+
+    1 {
+        set qsvariables   [dict create {*}[::rivet::var_qs all]]
+        set postvariables [dict create {*}[::rivet::var_post all]]
+
+        set qsvar   {qsarg1 qsarg2}
+        set postvar {postarg1 postarg2}
+
+        set qs ""
+        set post ""
+        foreach v $qsvar {lappend qs $v [dict get $qsvariables $v]}
+        foreach v $postvar {lappend post $v [dict get $postvariables $v]}
+        puts -nonewline "var_qs = $qs\nvar_post = $post"
+    }
+    2 {
+        #::rivet::parray server
+        # GET request: no var_post variables are supposed to be returned 
+
+        set qsvariables   [dict create {*}[::rivet::var_qs all]]
+        set postvariables [dict create {*}[::rivet::var_post all]]
+
+        if {[dict exists $postvariables qsarg1] || [dict exists $postvariables qsarg2]} { 
+            puts "KO: [::rivet::var_post all]" 
+        } else {
+            puts -nonewline "OK"
+        }
+
+    }
+    3 {
+        set qsvariables   [dict create {*}[::rivet::var_qs all]]
+        set postvariables [dict create {*}[::rivet::var_post all]]
+
+        if {[dict exists $qsvariables postarg1] || [dict exists $qsvariables postarg2]} { 
+            puts "KO: $qsvariables" 
+        } else {
+            puts -nonewline "OK"
+        }
+    }
+}
diff --git a/tests/post.test b/tests/post.test
index 77e9bf8..8fed8dc 100644
--- a/tests/post.test
+++ b/tests/post.test
@@ -37,3 +37,26 @@ set testfilename1 post.rvt
     regexp -line {^\[::rivet::var_post get foobar\] = goober$} [ ::http::data $page ] match
     set match
 } {[::rivet::var_post get foobar] = goober}
+
+set rivetscript "${urlbase}fqrivet_var.tcl"
+
+::tcltest::test postvariables-5.1 {::rivet::var_qs and ::rivet::var_post} {
+    set page [::http::geturl "${rivetscript}?qsarg1=val1&qsarg2=val2&t1=1" \
+                            -query [::http::formatQuery postarg1 val1 postarg2 val2]]
+    set match [::http::data $page]
+    set match
+} {var_qs = qsarg1 val1 qsarg2 val2
+var_post = postarg1 val1 postarg2 val2}
+
+::tcltest::test postvariables-5.2 {::rivet::var_post and ::rivet::var_qs crosstalk 1} {
+    set page [::http::geturl "${rivetscript}?qsarg1=val1&qsarg2=val2&t1=2"]
+    set match [::http::data $page]
+    set match
+} {OK}
+
+::tcltest::test postvariables-5.3 {::rivet::var_post and ::rivet::var_qs crosstalk 2} {
+    set page [::http::geturl "${rivetscript}?t1=3" \
+                              -query [::http::formatQuery postarg1 val1 postarg2 val2]]
+    set match [::http::data $page]
+    set match
+} {OK}


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