tcl-mod_dtcl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject cvs commit: tcl-moddtcl mod_dtcl.c mod_dtcl.h tcl_commands.c
Date Fri, 29 Jun 2001 16:38:03 GMT
davidw      01/06/29 09:38:03

  Modified:    .        mod_dtcl.c mod_dtcl.h tcl_commands.c
  Log:
  More globals out the window.  There may be a better way to do this
  using clientData, but it segfaults on me.
  
  Revision  Changes    Path
  1.36      +77 -67    tcl-moddtcl/mod_dtcl.c
  
  Index: mod_dtcl.c
  ===================================================================
  RCS file: /home/cvs/tcl-moddtcl/mod_dtcl.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- mod_dtcl.c	2001/06/28 15:31:33	1.35
  +++ mod_dtcl.c	2001/06/29 16:37:58	1.36
  @@ -57,7 +57,7 @@
    * originally written at the National Center for Supercomputing Applications,
    * University of Illinois, Urbana-Champaign.  */
   
  -/* $Id: mod_dtcl.c,v 1.35 2001/06/28 15:31:33 davidw Exp $  */
  +/* $Id: mod_dtcl.c,v 1.36 2001/06/29 16:37:58 davidw Exp $  */
   
   /* mod_dtcl.c by David Welton <davidw@apache.org> - originally mod_include.  */
   /* See http://tcl.apache.org/mod_dtcl/credits.ttml for additional credits. */
  @@ -86,20 +86,9 @@
      management stuff on obuff - malloc, free, etc., because I couldn't
      get it to work well with the apache functions - davidw */
   
  -obuff obuffer = {
  -    NULL,
  -    0
  -};
   
  -static Tcl_Obj *namespacePrologue;      /* initial bit of Tcl for namespace creation */
   module MODULE_VAR_EXPORT dtcl_module;
   
  -
  -int buffer_output = 0;          /* Start with output buffering off */
  -int headers_printed = 0; 	/* has the header been printed yet? */
  -static int headers_set = 0;     /* has the header been set yet? */
  -int content_sent = 0;           /* make sure something gets sent */
  -
   //dtcl_interp_globals globals;
   
   #define GETREQINTERP(req) ((dtcl_server_conf *)ap_get_module_config(req->server->module_config,
&dtcl_module))->server_interp
  @@ -148,13 +137,14 @@
   
   static int outputproc(ClientData instancedata, char *buf, int toWrite, int *errorCodePtr)
   {
  -    memwrite(&obuffer, buf, toWrite);
  +    dtcl_server_conf *dsc = (dtcl_server_conf *)instancedata;
  +    memwrite(dsc->obuffer, buf, toWrite);
       return toWrite;
   }
   
  -static int closeproc(ClientData instancedata, Tcl_Interp *interp2)
  +static int closeproc(ClientData instancedata, Tcl_Interp *interp)
   {
  -    dtcl_interp_globals *globals = Tcl_GetAssocData(interp2, "dtcl", NULL);
  +    dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
       print_headers(globals->r);
       flush_output_buffer(globals->r);
       return 0;
  @@ -211,10 +201,11 @@
   
   int set_header_type(request_rec *r, char *header)
   {
  -    if (headers_set == 0)
  +    dtcl_server_conf *dsc = dtcl_get_conf(r);
  +    if (*(dsc->headers_set) == 0)
       {
   	r->content_type = header;
  -	headers_set = 1;
  +	*(dsc->headers_set) = 1;
   	return 1;
       } else {
   	return 0;
  @@ -225,13 +216,14 @@
   
   int print_headers(request_rec *r)
   {
  -    if (headers_printed == 0)
  +    dtcl_server_conf *dsc = dtcl_get_conf(r);
  +    if (*(dsc->headers_printed) == 0)
       {
  -	if (headers_set == 0)
  +	if (*(dsc->headers_set) == 0)
   	    set_header_type(r, DEFAULT_HEADER_TYPE);
   
   	ap_send_http_header(r);
  -	headers_printed = 1;
  +	*(dsc->headers_printed) = 1;
   	return 1;
       } else {
   	return 0;
  @@ -267,14 +259,15 @@
   
   int flush_output_buffer(request_rec *r)
   {
  -    if (obuffer.len != 0)
  +    dtcl_server_conf *dsc = dtcl_get_conf(r);
  +    if (dsc->obuffer->len != 0)
       {
  -	ap_rwrite(obuffer.buf, obuffer.len, r);
  -	Tcl_Free(obuffer.buf);
  -	obuffer.len = 0;
  -	obuffer.buf = NULL;
  +	ap_rwrite(dsc->obuffer->buf, dsc->obuffer->len, r);
  +	Tcl_Free(dsc->obuffer->buf);
  +	dsc->obuffer->len = 0;
  +	dsc->obuffer->buf = NULL;
       }
  -    content_sent = 1;
  +    *(dsc->content_sent) = 1;
       return 0;
   }
   
  @@ -641,14 +634,15 @@
       int errstatus;
   
       Tcl_Interp *interp;
  +    
  +    dtcl_interp_globals *globals = NULL;
  +    dtcl_server_conf *dsc = NULL;
   
  -    dtcl_server_conf *dsc;
  -
  -    dtcl_interp_globals globals;
  -    globals.r = r;		/* Assign request to global request var */
  -
  -    interp = GETREQINTERP(r);
       dsc = dtcl_get_conf(r);
  +    globals = ap_pcalloc(r->pool, sizeof(dtcl_interp_globals));
  +    globals->r = r;
  +    interp = GETREQINTERP(r);
  +    Tcl_SetAssocData(interp, "dtcl", NULL, globals);
   
       r->allowed |= (1 << M_GET);
       r->allowed |= (1 << M_POST);
  @@ -683,7 +677,7 @@
       ap_cpystrn(timefmt, DEFAULT_TIME_FORMAT, sizeof(timefmt));
       ap_chdir_file(r->filename);
   
  -    if (Tcl_EvalObj(interp, namespacePrologue) == TCL_ERROR)
  +    if (Tcl_EvalObj(interp, dsc->namespacePrologue) == TCL_ERROR)
       {
   	ap_log_error(APLOG_MARK, APLOG_ERR, r->server, "Could not create request namespace\n");
   	return HTTP_BAD_REQUEST;
  @@ -691,22 +685,20 @@
   
       /* Apache Request stuff */
   
  -    globals.req = ApacheRequest_new(r);
  -    globals.r = r;
  -    Tcl_SetAssocData(interp, "dtcl", NULL, &globals); /* we use this instead of global_rr
*/
  +    globals->req = ApacheRequest_new(r);
   
  -    ApacheRequest_set_post_max(globals.req, dsc->upload_max);
  -    ApacheRequest_set_temp_dir(globals.req, dsc->upload_dir);
  +    ApacheRequest_set_post_max(globals->req, dsc->upload_max);
  +    ApacheRequest_set_temp_dir(globals->req, dsc->upload_dir);
   
   #if 0
       if (upload_files_to_var)
       {
  -	globals.req->hook_data = interp;
  -	globals.req->upload_hook = dtcl_upload_hook;
  +	globals->req->hook_data = interp;
  +	globals->req->upload_hook = dtcl_upload_hook;
       }
   #endif
   
  -    ApacheRequest___parse(globals.req);
  +    ApacheRequest___parse(globals->req);
   
       /* take results and create tcl variables from them */
   #if USE_ONLY_VAR_COMMAND == 1
  @@ -798,10 +790,10 @@
   
       get_parse_exec_file(r, dsc, 1);
       /* reset globals  */
  -    buffer_output = 0;
  -    headers_printed = 0;
  -    headers_set = 0;
  -    content_sent = 0;
  +    *(dsc->buffer_output) = 0;
  +    *(dsc->headers_printed) = 0;
  +    *(dsc->headers_set) = 0;
  +    *(dsc->content_sent) = 0;
   
       return OK;
   }
  @@ -809,20 +801,21 @@
   /* This is done in two places, so I decided to group the creates in
      one function */
   
  -static void tcl_create_commands(Tcl_Interp *interp)
  +static void tcl_create_commands(dtcl_server_conf *dsc)
   {
  -    Tcl_CreateObjCommand(interp, "hputs", Hputs, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  -    Tcl_CreateObjCommand(interp, "buffer_add", Buffer_Add, (ClientData)NULL, (Tcl_CmdDeleteProc
*)NULL);
  -    Tcl_CreateObjCommand(interp, "buffered", Buffered, (ClientData)NULL, (Tcl_CmdDeleteProc
*)NULL);
  -    Tcl_CreateObjCommand(interp, "headers", Headers, (ClientData)NULL, (Tcl_CmdDeleteProc
*)NULL);
  -    Tcl_CreateObjCommand(interp, "hgetvars", HGetVars, (ClientData)NULL, (Tcl_CmdDeleteProc
*)NULL);
  -    Tcl_CreateObjCommand(interp, "var", Var, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  -    Tcl_CreateObjCommand(interp, "upload", Upload, (ClientData)NULL, (Tcl_CmdDeleteProc
*)NULL);
  -    Tcl_CreateObjCommand(interp, "include", Include, (ClientData)NULL, (Tcl_CmdDeleteProc
*)NULL);
  -    Tcl_CreateObjCommand(interp, "parse", Parse, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  -    Tcl_CreateObjCommand(interp, "hflush", HFlush, (ClientData)NULL, (Tcl_CmdDeleteProc
*)NULL);
  -    Tcl_CreateObjCommand(interp, "dtcl_info", Dtcl_Info, (ClientData)NULL, (Tcl_CmdDeleteProc
*)NULL);
  -    Tcl_CreateObjCommand(interp, "no_body", No_Body, (ClientData)NULL, (Tcl_CmdDeleteProc
*)NULL);
  +    Tcl_Interp *interp = dsc->server_interp;
  +    Tcl_CreateObjCommand(interp, "hputs", Hputs, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "buffer_add", Buffer_Add, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "buffered", Buffered, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "headers", Headers, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "hgetvars", HGetVars, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "var", Var, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "upload", Upload, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "include", Include, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "parse", Parse, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "hflush", HFlush, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "dtcl_info", Dtcl_Info, NULL, (Tcl_CmdDeleteProc *)NULL);
  +    Tcl_CreateObjCommand(interp, "no_body", No_Body, NULL, (Tcl_CmdDeleteProc *)NULL);
   }
   
   static void tcl_init_stuff(server_rec *s, pool *p)
  @@ -838,7 +831,7 @@
       dsc->server_interp = interp; /* root interpreter */
   
       /* Create TCL commands to deal with Apache's BUFFs. */
  -    achan = Tcl_CreateChannel(&Achan, "apacheout", NULL, TCL_WRITABLE);
  +    achan = Tcl_CreateChannel(&Achan, "apacheout", dsc, TCL_WRITABLE);
   
       system_encoding = Tcl_GetEncoding(NULL, "iso8859-1"); /* FIXME */
   
  @@ -860,12 +853,12 @@
   	ap_log_error(APLOG_MARK, APLOG_ERR, s, Tcl_GetStringResult(interp));
   	exit(1);
       }
  -    tcl_create_commands(interp);
  -    namespacePrologue = Tcl_NewStringObj(
  +    tcl_create_commands(dsc);
  +    dsc->namespacePrologue = Tcl_NewStringObj(
   	"catch { namespace delete request }\n"
   	"namespace eval request { }\n"
   	"proc ::request::global { args } { foreach arg $args { uplevel \"::global ::request::$arg\"
} }\n", -1);
  -    Tcl_IncrRefCount(namespacePrologue);
  +    Tcl_IncrRefCount(dsc->namespacePrologue);
   
   #if DBG
       ap_log_error(APLOG_MARK, APLOG_ERR, s, "Config string = \"%s\"", Tcl_GetStringFromObj(dsc->dtcl_global_init_script,
NULL));  /* XXX */
  @@ -906,7 +899,7 @@
   	if (!mydsc->server_interp)
   	{
   	    mydsc->server_interp = Tcl_CreateSlave(interp, sr->server_hostname, 0);
  -	    tcl_create_commands(mydsc->server_interp);
  +	    tcl_create_commands(mydsc);
   	    Tcl_SetChannelOption(mydsc->server_interp, achan, "-buffering", "none");
   	    Tcl_RegisterChannel(mydsc->server_interp, achan);
   	}
  @@ -997,9 +990,6 @@
   }
   
   /* function to get a config, and merge the directory/server options  */
  -
  -/* NOTE that this returns values which cannot be modified, as they are
  -   just copies of the original! */
   dtcl_server_conf *dtcl_get_conf(request_rec *r)
   {
       dtcl_server_conf *newconfig = NULL;
  @@ -1013,6 +1003,7 @@
       {
   	newconfig = (dtcl_server_conf *) ap_pcalloc(r->pool, sizeof(dtcl_server_conf));
   	ddc = (dtcl_server_conf *) ap_get_module_config(dconf, &dtcl_module);
  +	newconfig->server_interp = dsc->server_interp;
   	newconfig->dtcl_before_script = ddc->dtcl_before_script ? ddc->dtcl_before_script
: dsc->dtcl_before_script;
   	newconfig->dtcl_after_script = ddc->dtcl_after_script ? ddc->dtcl_after_script
: dsc->dtcl_after_script;
   	newconfig->dtcl_error_script = ddc->dtcl_error_script ? ddc->dtcl_error_script
: dsc->dtcl_error_script;
  @@ -1020,6 +1011,14 @@
   	newconfig->cache_free = dsc->cache_free;
   	newconfig->objCacheList = dsc->objCacheList;
   	newconfig->objCache = dsc->objCache;
  +	newconfig->namespacePrologue = dsc->namespacePrologue;
  +	
  +	newconfig->buffer_output = dsc->buffer_output;
  +	newconfig->headers_printed = dsc->headers_printed;
  +	newconfig->headers_set = dsc->headers_set;
  +	newconfig->content_sent = dsc->content_sent;
  +	newconfig->obuffer = dsc->obuffer;
  +
   	return newconfig;
       }
       return dsc;
  @@ -1046,6 +1045,17 @@
       dsc->upload_dir = "/tmp";
       dsc->objCacheList = NULL;
       dsc->objCache = ap_pcalloc(p, sizeof(Tcl_HashTable));
  +    dsc->namespacePrologue = NULL;
  +
  +    dsc->buffer_output = ap_pcalloc(p, sizeof(int));
  +    dsc->headers_printed = ap_pcalloc(p, sizeof(int));
  +    dsc->headers_set = ap_pcalloc(p, sizeof(int));
  +    dsc->content_sent = ap_pcalloc(p, sizeof(int));
  +    *(dsc->buffer_output) = 0;
  +    *(dsc->headers_printed) = 0;
  +    *(dsc->headers_set) = 0;
  +    *(dsc->content_sent) = 0;
  +    dsc->obuffer = ap_pcalloc(p, sizeof(obuff));
       return dsc;
   }
   
  @@ -1081,7 +1091,7 @@
   /*     dsc->cache_size = overrides->cache_size ? overrides->cache_size : base->cache_size;
       dsc->cache_free = overrides->cache_free ? overrides->cache_free : base->cache_free;
 */
       dsc->upload_max = overrides->upload_max ? overrides->upload_max : base->upload_max;
  -    dsc->upload_files_to_var = overrides->upload_files_to_var ? overrides->upload_files_to_var
: base->upload_files_to_var;
  +/*     dsc->upload_files_to_var = overrides->upload_files_to_var ? overrides->upload_files_to_var
: base->upload_files_to_var;  */
       dsc->server_name = overrides->server_name ? overrides->server_name : base->server_name;
       dsc->upload_dir = overrides->upload_dir ? overrides->upload_dir : base->upload_dir;
   
  
  
  
  1.9       +17 -8     tcl-moddtcl/mod_dtcl.h
  
  Index: mod_dtcl.h
  ===================================================================
  RCS file: /home/cvs/tcl-moddtcl/mod_dtcl.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- mod_dtcl.h	2001/06/28 15:31:36	1.8
  +++ mod_dtcl.h	2001/06/29 16:37:59	1.9
  @@ -54,6 +54,11 @@
   /* #define DTCL_VERSION "X.X.X" */
   
   typedef struct {
  +    char *buf;
  +    int len;
  +} obuff;
  +
  +typedef struct {
       Tcl_Interp *server_interp;          /* per server Tcl interpreter */
       Tcl_Obj *dtcl_global_init_script;   /* run once when apache is first started */
       Tcl_Obj *dtcl_child_init_script;
  @@ -68,22 +73,26 @@
       char *server_name;
       char *upload_dir;
   
  -    char **objCacheList;    /* Array of cached objects (for priority handling) */
  +    char **objCacheList;     /* Array of cached objects (for priority handling) */
       Tcl_HashTable *objCache; /* Objects cache - the key is the script name */
  +
  +    Tcl_Obj *namespacePrologue; /* initial bit of Tcl for namespace creation */
  +
  +    /* stuff for buffering output */
  +    int *buffer_output;     /* Start with output buffering off */
  +    int *headers_printed; 	/* has the header been printed yet? */
  +    int *headers_set;       /* has the header been set yet? */
  +    int *content_sent;      /* make sure something gets sent */
  +    obuff *obuffer;
   } dtcl_server_conf;
   
   /* eventually we will transfer 'global' variables in here and
      'de-globalize' them */
   
   typedef struct {
  -    request_rec *r;         /* request rec */
  -    ApacheRequest *req;     /* libapreq request  */
  +    request_rec *r;             /* request rec */
  +    ApacheRequest *req;         /* libapreq request  */
   } dtcl_interp_globals;
  -
  -typedef struct {
  -    char *buf;
  -    int len;
  -} obuff;
   
   int memwrite(obuff *, char *, int);
   int get_parse_exec_file(request_rec *r, dtcl_server_conf *dsc, int toplevel);
  
  
  
  1.13      +29 -29    tcl-moddtcl/tcl_commands.c
  
  Index: tcl_commands.c
  ===================================================================
  RCS file: /home/cvs/tcl-moddtcl/tcl_commands.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- tcl_commands.c	2001/06/28 15:31:37	1.12
  +++ tcl_commands.c	2001/06/29 16:38:00	1.13
  @@ -20,10 +20,6 @@
   
   extern module dtcl_module;
   
  -extern obuff obuffer;
  -extern int content_sent;
  -extern int buffer_output;
  -extern int headers_printed;
   extern Tcl_Obj *uploadstorage[];
   
   #define POOL (globals->r->pool)
  @@ -34,9 +30,8 @@
   {
       char *filename;
       struct stat finfo;
  -
       dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  -    dtcl_server_conf *dsc = dtcl_get_conf(globals->r);
  +    dtcl_server_conf *dsc = (dtcl_server_conf *)ap_get_module_config(globals->r->server->module_config,
&dtcl_module);
   
       if (objc != 2)
       {
  @@ -69,6 +64,8 @@
       Tcl_Channel fd;
       int sz;
       char buf[BUFSZ];
  +    dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  +    dtcl_server_conf *dsc = (dtcl_server_conf *)ap_get_module_config(globals->r->server->module_config,
&dtcl_module);
   
       if (objc != 2)
       {
  @@ -99,7 +96,7 @@
   
           /* we could include code to either ap_pwrite this or memwrite
              it, depending on buffering */
  -	memwrite(&obuffer, buf, sz);
  +	memwrite(dsc->obuffer, buf, sz);
   
   	if (sz < BUFSZ - 1)
   	    break;
  @@ -116,6 +113,9 @@
   {
       char *arg1;
       int len;
  +    dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  +    dtcl_server_conf *dsc = (dtcl_server_conf *)ap_get_module_config(globals->r->server->module_config,
&dtcl_module);
  +  
       if (objc < 2)
       {
   	Tcl_WrongNumArgs(interp, 1, objv, "string");
  @@ -123,8 +123,8 @@
       }
       arg1 = Tcl_GetByteArrayFromObj(objv[1], &len);
   
  -    memwrite(&obuffer, arg1, len);
  -    content_sent = 0;
  +    memwrite(dsc->obuffer, arg1, len);
  +    *(dsc->content_sent) = 0;
       return TCL_OK;
   }
   
  @@ -134,8 +134,8 @@
   {
       char *arg1;
       int length;
  -
       dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  +    dtcl_server_conf *dsc = (dtcl_server_conf *)ap_get_module_config(globals->r->server->module_config,
&dtcl_module); 
   
       if (objc < 2)
       {
  @@ -161,9 +161,9 @@
   	    Tcl_WrongNumArgs(interp, 1, objv, "?-error? string");
   	    return TCL_ERROR;
   	}
  -	if (buffer_output == 1)
  +	if (*(dsc->buffer_output) == 1)
   	{
  -	    memwrite(&obuffer, arg1, length);
  +	    memwrite(dsc->obuffer, arg1, length);
   	} else {
   	    print_headers(globals->r);
   	    flush_output_buffer(globals->r);
  @@ -179,14 +179,15 @@
   int Headers(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
   {
       char *opt;
  -
       dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  +    dtcl_server_conf *dsc = (dtcl_server_conf *)ap_get_module_config(globals->r->server->module_config,
&dtcl_module);
  +
       if (objc < 2)
       {
   	Tcl_WrongNumArgs(interp, 1, objv, "option arg ?arg ...?");
   	return TCL_ERROR;
       }
  -    if (headers_printed != 0)
  +    if (*(dsc->headers_printed) != 0)
       {
   	Tcl_AddObjErrorInfo(interp, "Cannot manipulate headers - already sent", -1);
   	return TCL_ERROR;
  @@ -278,8 +279,8 @@
   int Buffered(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
   {
       char *opt = NULL; 
  -
       dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  +    dtcl_server_conf *dsc = (dtcl_server_conf *)ap_get_module_config(globals->r->server->module_config,
&dtcl_module); 
   
       if (objc != 2)
       {
  @@ -289,9 +290,9 @@
       opt = Tcl_GetStringFromObj(objv[1], NULL);
       if (!strncmp(opt, "on", 2))
       {
  -	buffer_output = 1;
  +	*(dsc->buffer_output) = 1;
       } else if (!strncmp(opt, "off", 3)) {
  -	buffer_output = 0;
  +	*(dsc->buffer_output) = 0;
   	print_headers(globals->r);
   	flush_output_buffer(globals->r);
       } else {
  @@ -334,16 +335,14 @@
   
       int i;
   
  +    dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  +
       array_header *hdrs_arr;
       table_entry *hdrs;
       array_header *env_arr;
       table_entry  *env;
  -
  -    dtcl_interp_globals *globals = NULL;
       Tcl_Obj *EnvsObj = NULL;
   
  -    globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  -
       EnvsObj = Tcl_NewStringObj("::request::ENVS", -1);
       Tcl_IncrRefCount(EnvsObj);
       date = globals->r->request_time;
  @@ -653,9 +652,7 @@
       Tcl_Obj *result = NULL;
       ApacheUpload *upload;
       dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  -    dtcl_server_conf *dsc = NULL;
  -
  -    dsc = (dtcl_server_conf *)ap_get_module_config(globals->r->server->module_config,
&dtcl_module);
  +    dtcl_server_conf *dsc = (dtcl_server_conf *)ap_get_module_config(globals->r->server->module_config,
&dtcl_module);
   
       if (objc < 2 || objc > 5)
       {
  @@ -828,7 +825,7 @@
   		       "</td></tr></table>\n", *(dsc->cache_free), getpid());
   /*     print_headers(globals->r);
       flush_output_buffer(globals->r);  */
  -    memwrite(&obuffer, tble, strlen(tble));
  +    memwrite(dsc->obuffer, tble, strlen(tble));
       return TCL_OK;
   }
   
  @@ -837,13 +834,16 @@
   
   int No_Body(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
   {
  +    
       dtcl_interp_globals *globals = Tcl_GetAssocData(interp, "dtcl", NULL);
  -    if (content_sent == 1)
  +    dtcl_server_conf *dsc = (dtcl_server_conf *)ap_get_module_config(globals->r->server->module_config,
&dtcl_module);
  +
  +    if (*(dsc->content_sent) == 1)
   	return TCL_ERROR;
   
       print_headers(globals->r);
  -    Tcl_Free(obuffer.buf);
  -    obuffer.buf = NULL;
  -    obuffer.len = 0;
  +    Tcl_Free(dsc->obuffer->buf);
  +    dsc->obuffer->buf = NULL;
  +    dsc->obuffer->len = 0;
       return TCL_OK;
   }
  
  
  

Mime
View raw message