tcl-websh-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@dedasys.com (David N. Welton)
Subject Re: open bug list / website
Date Fri, 09 Nov 2001 21:30:06 GMT

Ok, so here is my patch:

A couple of things to look at - I Incr the boolean variable, whereas
websh doesn't for the fileupload size, for instance.

I inserted another test in there by squeezing it in between another
two.  It looks kind of ugly - better places to put it/number it?

web::config cmdurltimestamp 0

seems to act globally (as would be expected) - it messed up
request.test, so I 'fixed' it by doing:

--- src/tests/request.test	2001/10/25 11:04:29	1.2
+++ src/tests/request.test	2001/11/09 21:12:25
@@ -27,6 +27,7 @@
     web::cmdurlcfg -unset
     web::formvar -unset
     web::param -unset
+    web::request -reset
 }

Cleaner ideas?

I'll hold off on committing this patch to see if there is any discussion.

Index: src/generic/cfg.c
===================================================================
RCS file: /home/cvs/tcl-websh/src/generic/cfg.c,v
retrieving revision 1.3
diff -u -r1.3 cfg.c
--- src/generic/cfg.c	2001/10/25 17:50:13	1.3
+++ src/generic/cfg.c	2001/11/09 21:12:23
@@ -124,20 +124,22 @@
 	NULL
     };
 
-    static char *subCmd1[] = { "uploadfilesize",
-	"encryptchain",
-	"decryptchain",
-	"cmdparam",
-	"timeparam",
-	"putxmarkup",
-	"logsubst",
-	"version",
-	"copyright",
-	NULL
+    static char *subCmd1[] = { "uploadfilesize",			       
+			       "encryptchain",
+			       "decryptchain",
+			       "cmdparam",
+			       "timeparam",
+			       "putxmarkup",
+			       "logsubst",
+			       "version",
+			       "copyright",
+			       "cmdurltimestamp",
+			       NULL
     };
 
     enum subCmd1
-    { UPLOADFILESIZE,
+    { 
+	UPLOADFILESIZE,
 	ENCRYPTCHAIN,
 	DECRYPTCHAIN,
 	CMDTAG,
@@ -145,7 +147,8 @@
 	PUTXMARKUP,
 	LOGSUBST,
 	WEBSHVERSION,
-	WEBSHCOPYRIGHT
+	WEBSHCOPYRIGHT,
+	CMDURLTIMESTAMP
     };
 
 
@@ -403,6 +406,42 @@
 			     NULL);
 	    return TCL_OK;
 	}
+    case CMDURLTIMESTAMP: {
+	int tmpbool = 1;
+	WebAssertData(interp, cfgData->requestData,
+		      "web::config cmdurltimestamp", TCL_ERROR);
+	
+	WebAssertData(interp, cfgData->requestData->cmdUrlTimestamp,
+			  "web::config cmdurltimestamp", TCL_ERROR);
+	Tcl_SetObjResult(interp,
+			 Tcl_DuplicateObj(cfgData->requestData->cmdUrlTimestamp));
+	switch (objc) {
+	case 2:
+	    return TCL_OK;
+	    break;
+	case 3:
+	    if (Tcl_GetBooleanFromObj(interp, objv[2], &tmpbool) ==
+		TCL_ERROR) {
+		LOG_MSG(interp, WRITE_LOG | SET_RESULT, __FILE__,
+			__LINE__, "web::config cmdurltimestamp",
+			WEBLOG_ERROR,
+			"web::config cmdurltimestamp only accepts boolean but ",
+			"got \"", Tcl_GetString(objv[2]), "\"", NULL);
+		return TCL_ERROR;
+	    }
+	    WebDecrOldIncrNew(cfgData->requestData->cmdUrlTimestamp,
+			      Tcl_DuplicateObj(objv[2]));
+	    return TCL_OK;
+	    break;
+	default:
+	    LOG_MSG(interp, WRITE_LOG | SET_RESULT,
+		    __FILE__, __LINE__,
+		    "web::config cmdurltimestamp", WEBLOG_INFO,
+		    "usage: web::config cmdurltimestamp ?boolean?", NULL);
+	    return TCL_ERROR;
+	}
+	return TCL_OK;
+    }
     default:
 	break;
     }
Index: src/generic/request.c
===================================================================
RCS file: /home/cvs/tcl-websh/src/generic/request.c,v
retrieving revision 1.3
diff -u -r1.3 request.c
--- src/generic/request.c	2001/10/25 17:50:13	1.3
+++ src/generic/request.c	2001/11/09 21:12:23
@@ -116,6 +116,8 @@
 
 	WebNewStringObjFromStringIncr(requestData->cmdTag, "cmd");
 	WebNewStringObjFromStringIncr(requestData->timeTag, "t");
+	requestData->cmdUrlTimestamp = Tcl_NewBooleanObj(1);
+	Tcl_IncrRefCount(requestData->cmdUrlTimestamp);
 
 	HashUtlAllocInit(requestData->request, TCL_STRING_KEYS);
 
@@ -175,6 +177,10 @@
     WebDecrRefCountIfNotNullAndSetNull(requestData->cmdTag);
     WebNewStringObjFromStringIncr(requestData->cmdTag, "cmd");
 
+    WebDecrRefCountIfNotNullAndSetNull(requestData->cmdUrlTimestamp);
+    requestData->cmdUrlTimestamp = Tcl_NewBooleanObj(1);
+    Tcl_IncrRefCount(requestData->cmdUrlTimestamp);
+
     requestData->requestIsInitialized = 0;
     return TCL_OK;
 }
@@ -232,7 +238,7 @@
 
 	WebDecrRefCountIfNotNull(requestData->cmdTag);
 	WebDecrRefCountIfNotNull(requestData->timeTag);
-
+	WebDecrRefCountIfNotNull(requestData->cmdUrlTimestamp);
 	destroyParamList(requestData->request);
 
 	WebDecrRefCountIfNotNull(requestData->upLoadFileSize);
Index: src/generic/request.h
===================================================================
RCS file: /home/cvs/tcl-websh/src/generic/request.h,v
retrieving revision 1.3
diff -u -r1.3 request.h
--- src/generic/request.h	2001/10/25 17:50:13	1.3
+++ src/generic/request.h	2001/11/09 21:12:23
@@ -81,6 +81,8 @@
     /* default: cmd */
     Tcl_Obj *timeTag;		/* key to be used for param in URL (web::cmdurl) */
     /* default: t */
+    Tcl_Obj *cmdUrlTimestamp;   /* send timestamp with url's */
+    /* default: true */
     /* ............ */
     Tcl_HashTable *request;	/* everything from the request obj */
     /* e.g. server_port, server_name and so on */
Index: src/generic/url.c
===================================================================
RCS file: /home/cvs/tcl-websh/src/generic/url.c,v
retrieving revision 1.3
diff -u -r1.3 url.c
--- src/generic/url.c	2001/10/25 17:50:13	1.3
+++ src/generic/url.c	2001/11/09 21:12:25
@@ -489,6 +489,7 @@
     int plistLen = 0;
     int i = 0;
     int flag = 0;
+    int bool = 1;
     int urlformat = 0;
     Tcl_Obj *urlFmt = NULL;
     Tcl_Obj *res = NULL;
@@ -535,6 +536,10 @@
     }
 
     if (argIndexOfKey(objc, objv, params[NOTIMESTAMP]) > 0)
+	flag = (flag | WEB_URL_NOTIMESTAMP);
+
+    Tcl_GetBooleanFromObj(interp, urlData->requestData->cmdUrlTimestamp, &bool);
+    if (bool == 0)
 	flag = (flag | WEB_URL_NOTIMESTAMP);
 
     /* --------------------------------------------------------------------------
Index: src/tests/cfg.test
===================================================================
RCS file: /home/cvs/tcl-websh/src/tests/cfg.test,v
retrieving revision 1.2
diff -u -r1.2 cfg.test
--- src/tests/cfg.test	2001/10/25 11:04:29	1.2
+++ src/tests/cfg.test	2001/11/09 21:12:25
@@ -26,7 +26,7 @@
 test cfg-1.1 {wrong subcommand} {
     catch {web::config foo bar} msg
     set msg
-} {bad subcommand "foo": must be uploadfilesize, encryptchain, decryptchain, cmdparam, timeparam,
putxmarkup, logsubst, version, or copyright}
+} {bad subcommand "foo": must be uploadfilesize, encryptchain, decryptchain, cmdparam, timeparam,
putxmarkup, logsubst, version, copyright, or cmdurltimestamp}
 
 
 test cfg-1.2 {invalid value} {
Index: src/tests/cmdurl.test
===================================================================
RCS file: /home/cvs/tcl-websh/src/tests/cmdurl.test,v
retrieving revision 1.2
diff -u -r1.2 cmdurl.test
--- src/tests/cmdurl.test	2001/10/25 11:04:29	1.2
+++ src/tests/cmdurl.test	2001/11/09 21:12:25
@@ -378,6 +378,25 @@
     set res
 } "v319 {} {}"
 
+test cmdurl-3.191 {no time and no cmd tag} {
+
+    cleanParam    
+
+    web::config cmdurltimestamp 0
+    web::config timeparam "t"
+    web::config cmdparam "cmd"
+
+    set url [web::cmdurl "" k3191 v3191]
+    set tmp [web::querystring::getfromurl $url]
+    web::dispatch -cmd "" -postdata "" -querystring $tmp
+    set res [web::param k3191]
+    lappend res [web::param t]
+    lappend res [web::param cmd]
+    unset url
+    unset tmp
+    set res
+} "v3191 {} {}"
+
 
 test cmdurl-3.20 {full web::param syntax for web::cmdurlcfg, all-in-one} {
 
Index: src/tests/request.test
===================================================================
RCS file: /home/cvs/tcl-websh/src/tests/request.test,v
retrieving revision 1.2
diff -u -r1.2 request.test
--- src/tests/request.test	2001/10/25 11:04:29	1.2
+++ src/tests/request.test	2001/11/09 21:12:25
@@ -27,6 +27,7 @@
     web::cmdurlcfg -unset
     web::formvar -unset
     web::param -unset
+    web::request -reset
 }
 
 # -----------------------------------------------------------------------------
Index: src/unix/configure.in
===================================================================
RCS file: /home/cvs/tcl-websh/src/unix/configure.in,v
retrieving revision 1.1
diff -u -r1.1 configure.in
--- src/unix/configure.in	2001/11/05 11:42:02	1.1
+++ src/unix/configure.in	2001/11/09 21:12:26
@@ -29,9 +29,9 @@
 
 PACKAGE=web
 
-MAJOR_VERSION=%%MAJOR_VERSION%%
-MINOR_VERSION=%%MINOR_VERSION%%
-PATCHLEVEL=%%PATCHLEVEL%%
+MAJOR_VERSION=3
+MINOR_VERSION=1
+PATCHLEVEL=0
 
 VERSION=${MAJOR_VERSION}.${MINOR_VERSION}${PATCHLEVEL}
 NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION}


Have a good weekend,
-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Mime
View raw message