You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2014/12/17 01:17:07 UTC

svn commit: r1646115 - in /tcl/rivet/trunk: ChangeLog configure.ac rivet/init.tcl rivet/rivet-tcl/redirect.tcl rivet/rivet-tcl/tclIndex src/experimental/mod_rivet.c src/experimental/rivet_prefork_mpm.c

Author: mxmanghi
Date: Wed Dec 17 00:17:06 2014
New Revision: 1646115

URL: http://svn.apache.org/r1646115
Log:
    * configure.ac: bumping version number to 2.3.0
    * rivet/init.tcl: recreated by automake
    * rivet/rivet-tcl/redirect.tcl: add new command ::rivet::redirect
    * src/experimental/mod_rivet.c: Tcl_Flush call moved from Rivet_ExecuteAndCheck to 
    the very end of Rivet_SendContent, also TclWeb_PrintHeader is now unique just before
    the I/O buffer is flushed


Added:
    tcl/rivet/trunk/rivet/rivet-tcl/redirect.tcl
Modified:
    tcl/rivet/trunk/ChangeLog
    tcl/rivet/trunk/configure.ac
    tcl/rivet/trunk/rivet/init.tcl
    tcl/rivet/trunk/rivet/rivet-tcl/tclIndex
    tcl/rivet/trunk/src/experimental/mod_rivet.c
    tcl/rivet/trunk/src/experimental/rivet_prefork_mpm.c

Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1646115&r1=1646114&r2=1646115&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Wed Dec 17 00:17:06 2014
@@ -1,10 +1,18 @@
+2014-12-16 Massimo Manghi <mx...@apache.org>
+    * configure.ac: bumping version number to 2.3.0
+    * rivet/init.tcl: recreated by automake
+    * rivet/rivet-tcl/redirect.tcl: add new command ::rivet::redirect
+    * src/experimental/mod_rivet.c: Tcl_Flush call moved from Rivet_ExecuteAndCheck to 
+    the very end of Rivet_SendContent, also TclWeb_PrintHeader is now unique just before
+    the I/O buffer is flushed
+
 2014-12-06 Massimo Manghi <mx...@apache.org>
     * src/experimental/mod_rivet.c,src/apache-2/mod_rivet.c: Rivet init package bound to
     be $(RIVET_MAJOR_VERSION).$(RIVET_MINOR_VERSION) and defined in autotool variable
     INIT_VERSION (to be transformed into RIVET_INIT_VERSION for C code includes)
     * rivet/rivet-tcl/read_file.c: argument lists admit a variable number of extra arguments
     to be evaluated as argument of 'fconfigure' call
-    * configure.ac: Macro symbol TCL_PACKAGE_VERSION changed into INIT_VERSION
+    * configure.ac: Macro symbol TCL_PACKAGE_VERSION renamed as INIT_VERSION
 
 2014-11-28 Massimo Manghi <mx...@apache.org>
     * src/experimental/mod_rivet.c: Rivet channel is set as stdout and as such is released

Modified: tcl/rivet/trunk/configure.ac
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/configure.ac?rev=1646115&r1=1646114&r2=1646115&view=diff
==============================================================================
--- tcl/rivet/trunk/configure.ac (original)
+++ tcl/rivet/trunk/configure.ac Wed Dec 17 00:17:06 2014
@@ -22,7 +22,7 @@ dnl
 # so you can encode the package version directly into the source files.
 #-----------------------------------------------------------------------
 
-AC_INIT([Rivet],[2.2.1])
+AC_INIT([Rivet],[2.3.0])
 TEA_INIT([3.9])
 
 AC_CONFIG_AUX_DIR(tclconfig)

Modified: tcl/rivet/trunk/rivet/init.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/init.tcl?rev=1646115&r1=1646114&r2=1646115&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/init.tcl (original)
+++ tcl/rivet/trunk/rivet/init.tcl Wed Dec 17 00:17:06 2014
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-package provide Rivet 2.2
+package provide Rivet 2.3
 
 namespace eval ::Rivet {
 

Added: tcl/rivet/trunk/rivet/rivet-tcl/redirect.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/rivet-tcl/redirect.tcl?rev=1646115&view=auto
==============================================================================
--- tcl/rivet/trunk/rivet/rivet-tcl/redirect.tcl (added)
+++ tcl/rivet/trunk/rivet/rivet-tcl/redirect.tcl Wed Dec 17 00:17:06 2014
@@ -0,0 +1,25 @@
+#
+# -- ::rivet::redirect
+#
+#  Redirecting to a new URL by issuing a 301 or 302 (permanent)
+# diversion to a new resource. 
+#
+# Arguments:
+#
+#   - url               - URL to which we are redirecting the client
+#   - permanent:[0 | 1] - whether redirection will be permanent (default)
+#
+#
+
+namespace eval ::rivet {
+
+    proc ::rivet::redirect {url {permanent 0}} {
+
+        ::rivet::no_body ; ## don’t output anything on a redirect
+        ::rivet::headers set Location $url
+        ::rivet::headers numeric [expr {$permanent ? "301" : "302"}]
+        ::rivet::abort_page ; ## stop any further processing
+
+    }
+
+}

Modified: tcl/rivet/trunk/rivet/rivet-tcl/tclIndex
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/rivet-tcl/tclIndex?rev=1646115&r1=1646114&r2=1646115&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/rivet-tcl/tclIndex (original)
+++ tcl/rivet/trunk/rivet/rivet-tcl/tclIndex Wed Dec 17 00:17:06 2014
@@ -27,3 +27,4 @@ set auto_index(::rivet::parray_table) [l
 set auto_index(::rivet::load_cookies) [list source [file join $dir load_cookies.tcl]]
 set auto_index(::rivet::http_accept) [list source [file join $dir http_accept.tcl]]
 set auto_index(::rivet::xml) [list source [file join $dir xml.tcl]]
+set auto_index(::rivet::redirect) [list source [file join $dir redirect.tcl]]

Modified: tcl/rivet/trunk/src/experimental/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/mod_rivet.c?rev=1646115&r1=1646114&r2=1646115&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/experimental/mod_rivet.c Wed Dec 17 00:17:06 2014
@@ -322,7 +322,7 @@ rivet_thread_private* Rivet_VirtualHosts
             to allocate from the module global pool */
 
         /*  this stuff must be allocated from the module global pool which
-         *  has the child process lifespan
+         *  has the child process' same lifespan
          */
 
         apr_thread_mutex_lock(module_globals->pool_mutex);
@@ -401,7 +401,8 @@ void Rivet_ProcessorCleanup (void *data)
     rivet_server_conf*      rsc = RIVET_SERVER_CONF(module_globals->server->module_config);
 
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, module_globals->server, 
-                 "Thread exiting after %d requests served", private->req_cnt);
+                 "Thread exiting after %d requests served (%d vhosts)", 
+                                        private->req_cnt,module_globals->vhosts_count);
 
     /* We are deleting the interpreters and release the thread channel. 
      * Rivet channel is set a stdout channel of Tcl and as such is treated
@@ -436,19 +437,18 @@ void Rivet_ProcessorCleanup (void *data)
         Tcl_UnregisterChannel(private->interps[i]->interp,*private->channel);       
         Tcl_DeleteInterp(private->interps[i]->interp);
 
-        i++;
-
         /* if separate_virtual_interps == 0 we are running the same interpreter
          * instance for each vhost, thus we can jump out of this loop after 
          * the first cycle as the only real intepreter object we have is stored
          * in private->interps[0]
          */
 
-    } while ((i < module_globals->vhosts_count) && rsc->separate_virtual_interps);
+    } while ((++i < module_globals->vhosts_count) && rsc->separate_virtual_interps);
+
     Tcl_DecrRefCount(private->request_init);
     Tcl_DecrRefCount(private->request_cleanup);
-
     apr_pool_destroy(private->pool);
+    
 }
 
 /* ----------------------------------------------------------------------------
@@ -654,7 +654,7 @@ Rivet_SendContent(rivet_thread_private *
     if (r->header_only && !private->running_conf->honor_header_only_reqs)
     {
         TclWeb_SetHeaderType(DEFAULT_HEADER_TYPE, globals->req);
-        TclWeb_PrintHeaders(globals->req);
+        //TclWeb_PrintHeaders(globals->req);
         retval = OK;
         goto sendcleanup;
     }
@@ -713,6 +713,10 @@ Rivet_SendContent(rivet_thread_private *
 
     retval = OK;
 sendcleanup:
+
+    TclWeb_PrintHeaders(globals->req);
+    Tcl_Flush(*(private->channel));
+
     globals->req->content_sent = 0;
 
     globals->page_aborting = 0;
@@ -725,7 +729,6 @@ sendcleanup:
     /* We reset this pointer to signal we have terminated the request processing */
 
     globals->r = NULL;
-
     //Tcl_MutexUnlock(&sendMutex);
     return retval;
 }
@@ -876,8 +879,8 @@ good:
         TclWeb_SetHeaderType (apr_pstrcat(globals->req->req->pool,"text/html;",
                               globals->req->charset,NULL),globals->req);
     }
-    TclWeb_PrintHeaders(globals->req);
-    Tcl_Flush(*(private->channel));
+    //TclWeb_PrintHeaders(globals->req);
+    //Tcl_Flush(*(private->channel));
     Tcl_Release(interp_obj->interp);
 
     return TCL_OK;

Modified: tcl/rivet/trunk/src/experimental/rivet_prefork_mpm.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/rivet_prefork_mpm.c?rev=1646115&r1=1646114&r2=1646115&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/rivet_prefork_mpm.c (original)
+++ tcl/rivet/trunk/src/experimental/rivet_prefork_mpm.c Wed Dec 17 00:17:06 2014
@@ -119,7 +119,7 @@ void Rivet_MPM_ChildInit (apr_pool_t* po
         if (private == NULL)
         {
             apr_thread_mutex_lock(module_globals->pool_mutex);
-            private             = apr_palloc (module_globals->pool,sizeof(rivet_thread_private));
+            private = apr_palloc (module_globals->pool,sizeof(rivet_thread_private));
             apr_thread_mutex_unlock(module_globals->pool_mutex);
 
             if (apr_pool_create(&private->pool, NULL) != APR_SUCCESS) 
@@ -138,8 +138,8 @@ void Rivet_MPM_ChildInit (apr_pool_t* po
             Tcl_IncrRefCount(private->request_init);
             Tcl_IncrRefCount(private->request_cleanup);
 
-            private->channel    = apr_pcalloc(private->pool,sizeof(Tcl_Channel));
-            private->interps    = apr_pcalloc(private->pool,module_globals->vhosts_count*sizeof(vhost_interp));
+            private->channel = apr_pcalloc(private->pool,sizeof(Tcl_Channel));
+            private->interps = apr_pcalloc(private->pool,module_globals->vhosts_count*sizeof(vhost_interp));
 
             apr_threadkey_private_set (private,rivet_thread_key);
         }



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