You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by da...@apache.org on 2002/09/27 19:28:17 UTC
cvs commit: tcl-rivet/tests/apachetest apachetest.tcl
davidw 2002/09/27 10:28:17
Modified: . ChangeLog
doc rivet.xml
src rivetCore.c rivetParser.c
tests hello.rvt include.html include.test parse.test
rivet.test
tests/apachetest apachetest.tcl
Added: tests lang.test
Log:
* src/rivetCore.c (Rivet_Include): "include" command now saves channel
encoding/translation, outputs the included file to stdout with
binary translation/encoding, and then resets the original settings.
Fixes problem with EUC-JP characters in included files.
* tests/lang.test: Added file to test LANG setting in server, to check
character encodings.
* tests/parse.test: Added EUC-JP characters to test that they come
through ok.
* tests/include.test: Added EUC-JP characters to test that they come
through ok.
Revision Changes Path
1.67 +16 -0 tcl-rivet/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /home/cvs/tcl-rivet/ChangeLog,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- ChangeLog 12 Sep 2002 05:50:04 -0000 1.66
+++ ChangeLog 27 Sep 2002 17:28:17 -0000 1.67
@@ -1,3 +1,19 @@
+2002-09-27 David N. Welton <da...@dedasys.com>
+
+ * src/rivetCore.c (Rivet_Include): "include" command now saves
+ channel encoding/translation, outputs the included file to stdout
+ with binary translation/encoding, and then resets the original
+ settings. Fixes problem with EUC-JP characters in included files.
+
+ * tests/lang.test: Added file to test LANG setting in server, to
+ check character encodings.
+
+ * tests/parse.test: Added EUC-JP characters to test that they come
+ through ok.
+
+ * tests/include.test: Added EUC-JP characters to test that they come
+ through ok.
+
2002-09-11 David N. Welton <da...@dedasys.com>
* src/TclWebapache.c (TclWeb_InitEnvVars): Don't do an
1.7 +34 -11 tcl-rivet/doc/rivet.xml
Index: rivet.xml
===================================================================
RCS file: /home/cvs/tcl-rivet/doc/rivet.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- rivet.xml 9 Sep 2002 06:54:55 -0000 1.6
+++ rivet.xml 27 Sep 2002 17:28:17 -0000 1.7
@@ -169,20 +169,43 @@
<varlistentry>
<term>
<cmdsynopsis>
- <command>Rivet_Script</command>
- <arg>GlobalInitScript</arg>
- <arg><replaceable>script</replaceable></arg>
+ <command>RivetServerConf</command>
+ <group choice="req">
+ <arg>CacheSize</arg>
+ <arg>GlobalInitScript</arg>
+ <arg>ChildInitScript</arg>
+ <arg>ChildExitScript</arg>
+ <arg>BeforeScript</arg>
+ <arg>AfterScript</arg>
+ <arg>UploadDirectory</arg>
+ <arg>UploadMaxSize</arg>
+ <arg>UploadFilesToVar</arg>
+ <arg>SeperateVirtualInterps</arg>
+ </group>
</cmdsynopsis>
</term>
<listitem>
- <para>
- Tcl script that is run when each interpreter is
- initialized. <option>script</option> is an actual Tcl
- script, so to run a file, you would do:
+ <para><command>RivetServerConf</command> specifies a global
+ option that is valid for the whole server.
</para>
- <programlisting>
- Rivet_Script GlobalInitScript "source /var/www/foobar.tcl"
- </programlisting>
+ <variablelist>
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>CacheSize</command>
+ <arg><replaceable>size</replaceable></arg>
+ </cmdsynopsis>
+ </term>
+ <listitem>
+ <para>
+ Sets the size of the internal page cache, where
+ <option><replaceable>size</replaceable></option>
+ is the number of byte-compiled pages to be cached
+ for future use.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</listitem>
</varlistentry>
<varlistentry>
1.26 +19 -2 tcl-rivet/src/rivetCore.c
Index: rivetCore.c
===================================================================
RCS file: /home/cvs/tcl-rivet/src/rivetCore.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- rivetCore.c 19 Jul 2002 22:36:19 -0000 1.25
+++ rivetCore.c 27 Sep 2002 17:28:17 -0000 1.26
@@ -111,8 +111,11 @@
{
int sz;
Tcl_Channel fd;
+ Tcl_Channel stdout;
Tcl_Obj *outobj;
char *filename;
+ Tcl_DString transoptions;
+ Tcl_DString encoptions;
rivet_interp_globals *globals = Tcl_GetAssocData(interp, "rivet", NULL);
@@ -148,7 +151,21 @@
Tcl_AddErrorInfo(interp, Tcl_PosixError(interp));
return TCL_ERROR;
}
- Tcl_WriteObj(Tcl_GetChannel(interp, "stdout", NULL), outobj);
+
+ /* What we are doing is saving the translation and encoding
+ * options, setting them both to binary, and the restoring the
+ * previous settings. */
+ Tcl_DStringInit(&transoptions);
+ Tcl_DStringInit(&encoptions);
+ stdout = Tcl_GetChannel(interp, "stdout", NULL);
+ Tcl_GetChannelOption(interp, stdout, "-translation", &transoptions);
+ Tcl_GetChannelOption(interp, stdout, "-encoding", &encoptions);
+ Tcl_SetChannelOption(interp, stdout, "-translation", "binary");
+ Tcl_WriteObj(stdout, outobj);
+ Tcl_SetChannelOption(interp, stdout, "-translation", Tcl_DStringValue(&transoptions));
+ Tcl_SetChannelOption(interp, stdout, "-encoding", Tcl_DStringValue(&encoptions));
+ Tcl_DStringFree(&transoptions);
+ Tcl_DStringFree(&encoptions);
return Tcl_Close(interp, fd);
}
1.5 +2 -2 tcl-rivet/src/rivetParser.c
Index: rivetParser.c
===================================================================
RCS file: /home/cvs/tcl-rivet/src/rivetParser.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- rivetParser.c 13 Mar 2002 06:51:18 -0000 1.4
+++ rivetParser.c 27 Sep 2002 17:28:17 -0000 1.5
@@ -64,7 +64,7 @@
* Rivet_GetRivetFile --
*
* Takes a filename, a flag to indicate whether we are operating at
- * the top level (not from within the "parse" command, a buffer to
+ * the top level (not from within the "parse" command), a buffer to
* fill in, and a TclWebRequest. Fills in outbuf with a parsed Rivet
* .rvt file, creating a Tcl script ready for execution.
*
1.2 +2 -1 tcl-rivet/tests/hello.rvt
Index: hello.rvt
===================================================================
RCS file: /home/cvs/tcl-rivet/tests/hello.rvt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hello.rvt 6 Jan 2002 13:30:54 -0000 1.1
+++ hello.rvt 27 Sep 2002 17:28:17 -0000 1.2
@@ -6,4 +6,5 @@
# i18n-1.1
puts "� � � � � � - El Burro Sabe M�s Que T�!\n"
-?>
\ No newline at end of file
+?>
+<p>���ܸ�(EUC-JP Japanese text)</p>
1.2 +2 -1 tcl-rivet/tests/include.html
Index: include.html
===================================================================
RCS file: /home/cvs/tcl-rivet/tests/include.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- include.html 24 Jan 2002 16:05:07 -0000 1.1
+++ include.html 27 Sep 2002 17:28:17 -0000 1.2
@@ -7,4 +7,5 @@
<td>row 2</td>
</tr>
</tbody>
- </table>
\ No newline at end of file
+ </table>
+<p>���ܸ�(EUC-JP Japanese text)</p>
\ No newline at end of file
1.5 +2 -1 tcl-rivet/tests/include.test
Index: include.test
===================================================================
RCS file: /home/cvs/tcl-rivet/tests/include.test,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- include.test 27 Jan 2002 15:43:43 -0000 1.4
+++ include.test 27 Sep 2002 17:28:17 -0000 1.5
@@ -23,5 +23,6 @@
</tr>
</tbody>
</table>
+<p>���ܸ�(EUC-JP Japanese text)</p>
</body>
</html>}
1.2 +3 -1 tcl-rivet/tests/parse.test
Index: parse.test
===================================================================
RCS file: /home/cvs/tcl-rivet/tests/parse.test,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- parse.test 27 Jan 2002 16:10:23 -0000 1.1
+++ parse.test 27 Sep 2002 17:28:17 -0000 1.2
@@ -18,5 +18,7 @@
� � � � � � - El Burro Sabe M�s Que T�!
+<p>���ܸ�(EUC-JP Japanese text)</p>
+
</body>
</html>}
1.18 +2 -2 tcl-rivet/tests/rivet.test
Index: rivet.test
===================================================================
RCS file: /home/cvs/tcl-rivet/tests/rivet.test,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- rivet.test 18 Mar 2002 21:49:19 -0000 1.17
+++ rivet.test 27 Sep 2002 17:28:17 -0000 1.18
@@ -50,7 +50,7 @@
# These tests start the server on their own
if { $testgroup3 } {
- foreach Test {broken.test config.test} {
+ foreach Test {broken.test config.test lang.test} {
source $Test
}
}
1.1 tcl-rivet/tests/lang.test
Index: lang.test
===================================================================
# $Id: lang.test,v 1.1 2002/09/27 17:28:17 davidw Exp $
# Try setting LANG environmental variable.
set env(LANG) "ja_JP.eucJP"
apachetest::start {} {
set testfilename1 include.rvt
::tcltest::test lang-1.1 {"include" with LANG} {
set page [ ::http::geturl "${urlbase}$testfilename1" ]
::http::data $page
} {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Include Test</title>
</head>
<body>
<h1>Include Test</h1>
<table>
<tbody>
<tr>
<td>row 1</td>
</tr>
<tr>
<td>row 2</td>
</tr>
</tbody>
</table>
<p>���ܸ�(EUC-JP Japanese text)</p>
</body>
</html>}
set testfilename1 parse.rvt
::tcltest::test parse-1.1 {Parse command} {
set page [ ::http::geturl "${urlbase}$testfilename1" ]
::http::data $page
} {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Parse Test</title>
</head>
<body>
<h1>Parse Test</h1>
Hello, World
? ? ? ? ? ? - El Burro Sabe M?s Que T?!
<p>���ܸ�(EUC-JP Japanese text)</p>
</body>
</html>}
}
unset env(LANG)
1.5 +15 -5 tcl-rivet/tests/apachetest/apachetest.tcl
Index: apachetest.tcl
===================================================================
RCS file: /home/cvs/tcl-rivet/tests/apachetest/apachetest.tcl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- apachetest.tcl 19 Jul 2002 22:36:19 -0000 1.4
+++ apachetest.tcl 27 Sep 2002 17:28:17 -0000 1.5
@@ -1,6 +1,6 @@
# $Id$
-# Tcl based Apache test suite, by David N. Welton <da...@dedasys.com>
+# Tcl-based Apache test suite, by David N. Welton <da...@dedasys.com>
# This test suite provides a means to create configuration files, and
# start apache with user-specified options. All it needs to run is
@@ -178,9 +178,19 @@
}
}
-# dump out a config
-# outfile is the file to write to.
-# extra is for extra config things we want to tack on.
+# apachetest::makeconf --
+
+# Creates a config file and writes it to disk.
+
+# Arguments:
+# outfile - the file to create/write to.
+# extra - extra config options to add.
+
+# Side Effects:
+# Creates a new config file.
+
+# Results:
+# None.
proc apachetest::makeconf { outfile {extra ""} } {
variable binname
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org