damonc      02/01/19 15:27:01

  Modified:    .        ChangeLog TODO
               rivet    init.tcl
               src      make.tcl mod_rivet.c rivetCore.c
  Log:
  * src/rivetCore.c
      Moved authorization from its own array into the env array as
      HTTP_USER and HTTP_PASS.
  
      Added an abort_page command which halts the sending of a request.
  
  Revision  Changes    Path
  1.22      +8 -0      tcl-rivet/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/ChangeLog,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ChangeLog 19 Jan 2002 16:11:52 -0000      1.21
  +++ ChangeLog 19 Jan 2002 23:27:01 -0000      1.22
  @@ -1,3 +1,11 @@
  +2002-01-19  Damon J. Courtney <[EMAIL PROTECTED]>
  +
  +     * src/rivetCore.c
  +         Moved authorization from its own array into the env array as
  +         HTTP_USER and HTTP_PASS.
  +
  +         Added an abort_page command which halts the sending of a request.
  +
   2002-01-19  David N. Welton  <[EMAIL PROTECTED]>
   
        * src/TclWebapache.c: Added individual functions for CGI variable
  
  
  
  1.4       +7 -0      tcl-rivet/TODO
  
  Index: TODO
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/TODO,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TODO      8 Jan 2002 09:56:00 -0000       1.3
  +++ TODO      19 Jan 2002 23:27:01 -0000      1.4
  @@ -1,3 +1,8 @@
  +Write commands after like 'open' and such in the request namespace that
  +keep track of open file pointers and close them in the cleanup.
  +
  +Complete the NWS package.
  +
   Swipe include_* from NWS and rework it like:
       include ?-virtual? ?-noparse? file
   
  @@ -19,6 +24,8 @@
   Maybe write load_cookies in Tcl and try to get rid of the apache_cookie.* 
stuff.
   
   Maybe write the header command in Tcl.
  +
  +Maybe move ::request commands into a file called request.tcl.
   
   
   DONE
  
  
  
  1.2       +12 -0     tcl-rivet/rivet/init.tcl
  
  Index: init.tcl
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/rivet/init.tcl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- init.tcl  8 Jan 2002 09:34:42 -0000       1.1
  +++ init.tcl  19 Jan 2002 23:27:01 -0000      1.2
  @@ -1,5 +1,12 @@
   namespace eval ::Rivet {
   
  +    ###
  +    ## This routine gets called each time a new request comes in.
  +    ## It sets up the request namespace and creates a global command
  +    ## to replace the default global.  This ensures that when a user
  +    ## uses global variables, they're actually contained within the
  +    ## namespace.  So, everything gets deleted when the request is finished.
  +    ###
       proc initialize_request {} {
        catch { namespace delete ::request }
   
  @@ -12,6 +19,10 @@
        }
       }
   
  +    ###
  +    ## This routine gets called each time a request is finished.  Any kind
  +    ## of special cleanup can be placed here.
  +    ###
       proc cleanup_request {} {
   
       }
  @@ -47,4 +58,5 @@
   
   } ;## namespace eval ::Rivet
   
  +## Initialize Rivet.
   ::Rivet::init
  
  
  
  1.13      +2 -2      tcl-rivet/src/make.tcl
  
  Index: make.tcl
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/make.tcl,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- make.tcl  19 Jan 2002 16:11:52 -0000      1.12
  +++ make.tcl  19 Jan 2002 23:27:01 -0000      1.13
  @@ -2,7 +2,7 @@
   # the next line restarts using tclsh \
        exec tclsh "$0" "$@"
   
  -# $Id: make.tcl,v 1.12 2002/01/19 16:11:52 davidw Exp $
  +# $Id: make.tcl,v 1.13 2002/01/19 23:27:01 damonc Exp $
   
   # this file actually runs things, making use of the aardvark build
   # system.
  @@ -16,7 +16,7 @@
   
   # add variables
   
  -set APXS "apxs"
  +set APXS "/usr/local/apache/bin/apxs"
   
   set INC "-I[exec $APXS -q INCLUDEDIR] -I$TCL_PREFIX/include"
   
  
  
  
  1.23      +6 -3      tcl-rivet/src/mod_rivet.c
  
  Index: mod_rivet.c
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/mod_rivet.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- mod_rivet.c       12 Jan 2002 01:03:30 -0000      1.22
  +++ mod_rivet.c       19 Jan 2002 23:27:01 -0000      1.23
  @@ -55,7 +55,7 @@
    * originally written at the National Center for Supercomputing Applications,
    * University of Illinois, Urbana-Champaign.  */
   
  -/* $Id: mod_rivet.c,v 1.22 2002/01/12 01:03:30 damonc Exp $  */
  +/* $Id: mod_rivet.c,v 1.23 2002/01/19 23:27:01 damonc Exp $  */
   
   /* mod_rivet.c by David Welton <[EMAIL PROTECTED]>
    *            and Damon Courtney <[EMAIL PROTECTED]>
  @@ -425,6 +425,7 @@
       array_header *arr;
       table_entry  *elts;
       int i, nelts;
  +    Tcl_Obj *arrayName;
   
       /* Make sure RivetDirConf doesn't exist from a previous request. */
       Tcl_UnsetVar( interp, "RivetDirConf", TCL_GLOBAL_ONLY );
  @@ -434,11 +435,12 @@
       arr   = ap_table_elts( t );
       elts  = (table_entry *)arr->elts;
       nelts = arr->nelts;
  +    arrayName = Tcl_NewStringObj( "RivetDirConf", -1 );
   
       for( i = 0; i < nelts; ++i )
       {
        Tcl_ObjSetVar2(interp,
  -                    Tcl_NewStringObj("RivetDirConf", -1),
  +                    arrayName,
                       Tcl_NewStringObj( elts[i].key, -1),
                       Tcl_NewStringObj( elts[i].val, -1),
                       TCL_GLOBAL_ONLY);
  @@ -452,11 +454,12 @@
       arr   = ap_table_elts( t );
       elts  = (table_entry *)arr->elts;
       nelts = arr->nelts;
  +    arrayName = Tcl_NewStringObj( "RivetUserConf", -1 );
   
       for( i = 0; i < nelts; ++i )
       {
        Tcl_ObjSetVar2(interp,
  -                    Tcl_NewStringObj("RivetUserConf", -1),
  +                    arrayName,
                       Tcl_NewStringObj( elts[i].key, -1),
                       Tcl_NewStringObj( elts[i].val, -1),
                       TCL_GLOBAL_ONLY);
  
  
  
  1.6       +33 -11    tcl-rivet/src/rivetCore.c
  
  Index: rivetCore.c
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/src/rivetCore.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- rivetCore.c       19 Jan 2002 12:52:57 -0000      1.5
  +++ rivetCore.c       19 Jan 2002 23:27:01 -0000      1.6
  @@ -2,7 +2,7 @@
    * rivetCore.c - Core commands which are compiled into mod_rivet itself.
    */
   
  -/* $Id: rivetCore.c,v 1.5 2002/01/19 12:52:57 davidw Exp $ */
  +/* $Id: rivetCore.c,v 1.6 2002/01/19 23:27:01 damonc Exp $ */
   
   #include "httpd.h"
   #include "http_config.h"
  @@ -20,6 +20,7 @@
   #include "apache_request.h"
   #include "apache_cookie.h"
   #include "mod_rivet.h"
  +#include "rivet.h"
   
   #define BUFSZ 4096
   
  @@ -273,11 +274,11 @@
       Tcl_Obj *CONST objv[])
   {
       char *timefmt = DEFAULT_TIME_FORMAT;
  +    char *auth = NULL;
   #ifndef WIN32
       struct passwd *pw;
   #endif /* ndef WIN32 */
       char *t;
  -    char *authorization = NULL;
   
       time_t date;
   
  @@ -318,24 +319,22 @@
       env     = (table_entry *) env_arr->elts;
   
       /* Get the user/pass info for Basic authentication */
  -    (const char*)authorization =
  -     ap_table_get(globals->r->headers_in, "Authorization");
  -    if (authorization
  -     && !strcasecmp(ap_getword_nc(POOL, &authorization, ' '), "Basic"))
  +    (const char*)auth = ap_table_get(globals->r->headers_in, 
"Authorization");
  +    if ( auth && STREQU(ap_getword_nc(POOL, &auth, ' '), "Basic") )
       {
        char *tmp;
        char *user;
        char *pass;
   
  -     tmp = ap_pbase64decode(POOL, authorization);
  +     tmp = ap_pbase64decode(POOL, auth);
        user = ap_getword_nulls_nc(POOL, &tmp, ':');
        pass = tmp;
  -     Tcl_ObjSetVar2(interp, Tcl_NewStringObj("::request::USER", -1),
  -                    Tcl_NewStringObj("user", -1),
  +     Tcl_ObjSetVar2(interp, ArrayObj,
  +                    Tcl_NewStringObj("HTTP_USER", -1),
                       STRING_TO_UTF_TO_OBJ(user, POOL),
                       0);
  -     Tcl_ObjSetVar2(interp, Tcl_NewStringObj("::request::USER", -1),
  -                    Tcl_NewStringObj("pass", -1),
  +     Tcl_ObjSetVar2(interp, ArrayObj,
  +                    Tcl_NewStringObj("HTTP_PASS", -1),
                       STRING_TO_UTF_TO_OBJ(pass, POOL),
                       0);
       }
  @@ -883,6 +882,26 @@
       return TCL_OK;
   }
   
  +TCL_CMD_HEADER( Rivet_AbortPageCmd )
  +{
  +    rivet_interp_globals *globals = Tcl_GetAssocData(interp, "rivet", NULL);
  +    rivet_server_conf *rsc =
  +     RIVET_SERVER_CONF( globals->r->server->module_config );
  +
  +    if (objc != 1)
  +    {
  +     Tcl_WrongNumArgs(interp, 1, objv, "");
  +     return TCL_ERROR;
  +    }
  +
  +    Rivet_PrintHeaders(globals->r);
  +    Tcl_Flush(*(rsc->outchannel));
  +
  +    globals->r->connection->aborted = 1;
  +
  +    return TCL_OK;
  +}
  +
   int
   Rivet_InitCore( Tcl_Interp *interp )
   {
  @@ -936,5 +955,8 @@
                        Rivet_NoBody,
                        NULL,
                        (Tcl_CmdDeleteProc *)NULL);
  +
  +    TCL_OBJ_CMD( "abort_page", Rivet_AbortPageCmd );
  +
       return TCL_OK;
   }
  
  
  

Reply via email to