You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-cvs@tcl.apache.org by he...@apache.org on 2002/02/26 18:07:25 UTC

cvs commit: tcl-websh/src/generic interpool.c logtoap.h request_ap.c response_ap.c webout.c

hefti       02/02/26 09:07:25

  Modified:    src/generic interpool.c logtoap.h request_ap.c response_ap.c
                        webout.c
  Log:
  after discussion about fixmes with av,rb,sh,David
  
  Revision  Changes    Path
  1.5       +10 -5     tcl-websh/src/generic/interpool.c
  
  Index: interpool.c
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/interpool.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- interpool.c	18 Feb 2002 10:24:20 -0000	1.4
  +++ interpool.c	26 Feb 2002 17:07:25 -0000	1.5
  @@ -9,7 +9,7 @@
    * See the file "license.terms" for information on usage and
    * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    *
  - * @(#) $Id: interpool.c,v 1.4 2002/02/18 10:24:20 ronnie Exp $
  + * @(#) $Id: interpool.c,v 1.5 2002/02/26 17:07:25 hefti Exp $
    *
    */
   
  @@ -167,6 +167,7 @@
       webInterp->numrequests = 0;
   
       /* checkme: set correct starttime */
  +    /* fixme: use request_rec.request_time */
       time(&t);
       webInterp->starttime = (long) t;
       webInterp->lastusedtime = (long) t;
  @@ -194,7 +195,7 @@
   	    webInterpClass->mtime = mtime;
   	}
   	else {
  -	    /* fixme: BIG EXCEPTION, what to do? */
  +	    /* fixme: BIG EXCEPTION. log webInterp.interp.result to apache */
   	    webInterp->code = NULL;
   	}
       }
  @@ -214,7 +215,7 @@
   	result = Tcl_Eval(webInterp->interp, "web::finalize");
   
   	if (result != TCL_OK) {
  -	    /* fixme: log the message into our main interp */
  +	    /* fixme: log the message to apache */
   	}
   
   	Tcl_ResetResult(webInterp->interp);
  @@ -331,6 +332,9 @@
   	    /* invalidate all interpreters, code must be loaded from scratch */
   	    webInterp = webInterpClass->first;
   	    while (webInterp != NULL) {
  +
  +	      /* fixme: make expiring message easy to understand (add WebInterpClass.filename, times ...) */
  +
   		logToAp(webInterp->interp, NULL,
   			"interpreter expired (source changed)");
   		if (webInterp->state == WIP_INUSE)
  @@ -347,6 +351,7 @@
   	}
   
   	/* search a free interp */
  +	/* fixme: use request_req.request_time */
   	time(&t);
   	webInterp = webInterpClass->first;
   
  @@ -354,7 +359,7 @@
   
   	    if ((webInterp->state) == WIP_FREE) {
   
  -		/* fixme: put id in log (for easier debugging) */
  +	      /* fixme: make expiring message easy to understand (add WebInterpClass.filename, times ...) */
   
   		/* check for expiry */
   		if (webInterpClass->maxidletime
  @@ -401,7 +406,7 @@
   
   	    Tcl_MutexUnlock(&(conf->webshPoolLock));
   	    Tcl_DecrRefCount(idObj);
  -	    /* fixme: do something useful */
  +	    /* fixme: log to apache *somehow* */
   	    /* logToAp(webInterp->interp,NULL,"panic - cannot create webInterpClass '%s'", id); */
   
   	    return NULL;
  
  
  
  1.4       +1 -3      tcl-websh/src/generic/logtoap.h
  
  Index: logtoap.h
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/logtoap.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- logtoap.h	25 Oct 2001 17:50:13 -0000	1.3
  +++ logtoap.h	26 Feb 2002 17:07:25 -0000	1.4
  @@ -9,15 +9,13 @@
    * See the file "license.terms" for information on usage and
    * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    *
  - * @(#) $Id: logtoap.h,v 1.3 2001/10/25 17:50:13 davidw Exp $
  + * @(#) $Id: logtoap.h,v 1.4 2002/02/26 17:07:25 hefti Exp $
    *
    */
   
   #ifndef WEB_LOGTOAP_H
   #define WEB_LOGTOAP_H
   
  -/* fixme: not specified yet */
  -#define WEB_LOGTOAP_USAGE "?-unbuffered? TBD"
   
   /* ----------------------------------------------------------------------------
    * plugin logger: toAp
  
  
  
  1.6       +3 -4      tcl-websh/src/generic/request_ap.c
  
  Index: request_ap.c
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/request_ap.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- request_ap.c	12 Dec 2001 12:47:10 -0000	1.5
  +++ request_ap.c	26 Feb 2002 17:07:25 -0000	1.6
  @@ -9,7 +9,7 @@
    * See the file "license.terms" for information on usage and
    * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    *
  - * @(#) $Id: request_ap.c,v 1.5 2001/12/12 12:47:10 davidw Exp $
  + * @(#) $Id: request_ap.c,v 1.6 2002/02/26 17:07:25 hefti Exp $
    *
    */
   
  @@ -88,12 +88,11 @@
   	    valo = Tcl_NewStringObj(hdrs[i].val, -1);
   
   	if (paramListAdd(requestData->request, hdrs[i].key, valo) != TCL_OK)
  -	    /* fata case */
  +	    /* fatal case */
   	    return TCL_ERROR;
       }
   
  -    /* fixme: better name */
       paramListSetAsWhole(requestData->request, "GATEWAY_INTERFACE",
  -			Tcl_NewStringObj("websh", -1));
  +			Tcl_NewStringObj("CGI-websh/1.1", -1));
       return TCL_OK;
   }
  
  
  
  1.4       +26 -22    tcl-websh/src/generic/response_ap.c
  
  Index: response_ap.c
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/response_ap.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- response_ap.c	25 Oct 2001 17:50:13 -0000	1.3
  +++ response_ap.c	26 Feb 2002 17:07:25 -0000	1.4
  @@ -9,7 +9,7 @@
    * See the file "license.terms" for information on usage and
    * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    *
  - * @(#) $Id: response_ap.c,v 1.3 2001/10/25 17:50:13 davidw Exp $
  + * @(#) $Id: response_ap.c,v 1.4 2002/02/26 17:07:25 hefti Exp $
    *
    */
   
  @@ -43,7 +43,6 @@
   	char *key;
   	Tcl_Obj *headerList;
   
  -	/* fixme: might get that differently */
   	r = (request_rec *) Tcl_GetAssocData(interp, WEB_AP_ASSOC_DATA, NULL);
   	if (r == NULL) {
   	    Tcl_SetResult(interp, "error accessing httpd request object",
  @@ -53,11 +52,16 @@
   
   	httpResponse = responseObj->httpresponse;
   	if (httpResponse != NULL) {
  -	    /* fixme: is this the proper way of dealing with the problem that
  -	     * apache ALWAYS adds the protocol by itself? */
  -	    char *response = strchr(Tcl_GetString(httpResponse), (int) ' ');
  -	    if (response)
  +
  +	  /* note: looks like this is the only way to set a status line in ap
  +	   * - still looking for better solutions, though */
  +
  +	  /* 404 not found */
  +	  char *response = strchr(Tcl_GetString(httpResponse), (int) ' ');
  +	  /* _not found */
  +	  if (response)
   #ifndef APACHE2
  +	      /* not found */
   		r->status_line = ap_pstrdup(r->pool, ++response);
   #else /* APACHE2 */
   		r->status_line = (char *) apr_pstrdup(r->pool, ++response);
  @@ -80,32 +84,32 @@
   				Tcl_GetStringResult(interp), NULL);
   			return TCL_ERROR;
   		    }
  -		    /* add all occurrences of this header */
  -		    /* fixme: ap_table_setn overwrites -> only last header is set !!! */
  +
  +		    /* fixme
  +		     *
  +		     * use ap_table_set unless web::response -count key is > 1
  +		     * then use set for the first and add for the others.
  +		     */
  +
   		    for (i = 0; i < lobjc; i++) {
  -			/* fixme: check if case insenitive case compare */
  -			if (strcmp(key, "Content-Type") == 0) {
  +		      if (strcasecmp(key, "Content-Type") == 0) {
   #ifndef APACHE2
   			    r->content_type =
   				ap_pstrdup(r->pool, Tcl_GetString(lobjv[i]));
   			}
   			else {
  -			    ap_table_setn(r->headers_out,
  -					  ap_pstrdup(r->pool, key),
  -					  ap_pstrdup(r->pool,
  -						     Tcl_GetString(lobjv
  -								   [i])));
  +			    ap_table_add(r->headers_out,
  +					 key,
  +					 Tcl_GetString(lobjv[i]));
   #else /* APACHE2 */
   			    r->content_type =
   				(char *) apr_pstrdup(r->pool,
   						     Tcl_GetString(lobjv[i]));
   			}
   			else {
  -			    apr_table_setn(r->headers_out,
  -					   (char *) apr_pstrdup(r->pool, key),
  -					   (char *) apr_pstrdup(r->pool,
  -								Tcl_GetString
  -								(lobjv[i])));
  +			    apr_table_add(r->headers_out,
  +					  key,
  +					  Tcl_GetString(lobjv[i]));
   #endif /* APACHE2 */
   			}
   		    }
  @@ -115,8 +119,8 @@
   #ifndef APACHE2
   	ap_send_http_header(r);
   #else /* APACHE2 */
  -	/* fixme: how to force headers to be sent? */
  -	/*ap_send_http_header(r); */
  +	/* fixme: ap 2.0 API might change this call ? */
  +	/* ap_send_http_header(r); */
   #endif /* APACHE2 */
   	responseObj->sendHeader = 0;
       }
  
  
  
  1.6       +2 -4      tcl-websh/src/generic/webout.c
  
  Index: webout.c
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/webout.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- webout.c	14 Feb 2002 21:19:41 -0000	1.5
  +++ webout.c	26 Feb 2002 17:07:25 -0000	1.6
  @@ -9,7 +9,7 @@
    * See the file "license.terms" for information on usage and
    * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    *
  - * @(#) $Id: webout.c,v 1.5 2002/02/14 21:19:41 davidw Exp $
  + * @(#) $Id: webout.c,v 1.6 2002/02/26 17:07:25 hefti Exp $
    *
    */
   
  @@ -231,7 +231,7 @@
       }
   
       /* handle first paramList things */
  -    /* fixme: here the keys might not be strictly case sensitive */
  +    /* note: the keys might not be strictly case sensitive */
       res = paramGet((ParamList *) responseObj->headers, interp, objc, objv, 1);
   
       if (res == TCL_CONTINUE) {
  @@ -348,8 +348,6 @@
   		    if (old->name != NULL)
   			Tcl_SetObjResult(interp, old->name);
   		    return TCL_OK;
  -		    /* fixme: same error msg as above if there's no
  -		     * name, but preferably at one place */
   		    break;
   		}
   
  
  
  

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