You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2015/01/09 00:06:15 UTC
svn commit: r1650415 - in /tcl/rivet/trunk: configure.ac
doc/xml/commands.xml src/experimental/TclWebapache.c
src/experimental/rivetCore.c
Author: mxmanghi
Date: Thu Jan 8 23:06:14 2015
New Revision: 1650415
URL: http://svn.apache.org/r1650415
Log:
adding test on value of output headers
Modified:
tcl/rivet/trunk/configure.ac
tcl/rivet/trunk/doc/xml/commands.xml
tcl/rivet/trunk/src/experimental/TclWebapache.c
tcl/rivet/trunk/src/experimental/rivetCore.c
Modified: tcl/rivet/trunk/configure.ac
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/configure.ac?rev=1650415&r1=1650414&r2=1650415&view=diff
==============================================================================
--- tcl/rivet/trunk/configure.ac (original)
+++ tcl/rivet/trunk/configure.ac Thu Jan 8 23:06:14 2015
@@ -376,11 +376,11 @@ AC_DEFUN([APU_HANDLING],[
AC_ARG_WITH(
apu_config,
[ --with-apu-config=FILE apu portable apu-1-config path],
- [if "${with_apu_config}" --version; then
+ [if "${with_apu_config}" --version; then
apu_found="${with_apu_config}"
- fi]
- ,
- [if test apu-1-config --version; then
+ fi]
+ ,
+ [if apu-1-config --version; then
apu_found=apu-1-config
elif test -x "${apache_base}/bin/apu-1-config" ; then
apu_found="${apache_base}/bin/apu-1-config"
Modified: tcl/rivet/trunk/doc/xml/commands.xml
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/doc/xml/commands.xml?rev=1650415&r1=1650414&r2=1650415&view=diff
==============================================================================
--- tcl/rivet/trunk/doc/xml/commands.xml (original)
+++ tcl/rivet/trunk/doc/xml/commands.xml Thu Jan 8 23:06:14 2015
@@ -572,113 +572,147 @@
<refentry id="headers">
<refnamediv>
- <refname>headers</refname>
- <refpurpose>set and parse HTTP headers.</refpurpose>
+ <refname>headers</refname>
+ <refpurpose>set and parse HTTP headers.</refpurpose>
</refnamediv>
<refsynopsisdiv>
- <cmdsynopsis>
- <command>::rivet::headers</command>
- <group choice="req">
- <arg>set</arg>
- <arg>redirect</arg>
- <arg>add</arg>
- <arg>type</arg>
- <arg>numeric</arg>
- </group>
- </cmdsynopsis>
+ <cmdsynopsis>
+ <command>::rivet::headers</command>
+ <group choice="req">
+ <arg>get</arg>
+ <arg>set</arg>
+ <arg>sent</arg>
+ <arg>redirect</arg>
+ <arg>add</arg>
+ <arg>type</arg>
+ <arg>numeric</arg>
+ </group>
+ </cmdsynopsis>
</refsynopsisdiv>
<refsect1>
- <title>Description</title>
- <para>
- The <command>headers</command> command is for setting and
- parsing HTTP headers.
- </para>
+ <title>Description</title>
+ <para>
+ The <command>headers</command> command is for setting and
+ parsing HTTP headers.
+ </para>
- <variablelist>
- <varlistentry>
- <term>
- <cmdsynopsis>
- <command>::rivet::headers</command>
- <arg choice="plain">set</arg>
- <arg><replaceable>headername</replaceable></arg>
- <arg><replaceable>value</replaceable></arg>
- </cmdsynopsis>
- </term>
- <listitem>
- <para>
- Set arbitrary header names and values.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
- <cmdsynopsis>
- <command>::rivet::headers</command>
- <arg choice="plain">redirect</arg>
- <arg><replaceable>uri</replaceable></arg>
- </cmdsynopsis>
- </term>
- <listitem>
- <para>
- Redirect from the current page to a new
- URI. <emphasis>Must</emphasis> be done in the first block
- of TCL code.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
- <cmdsynopsis>
- <command>::rivet::headers</command>
- <arg choice="plain">add</arg>
- <arg><replaceable>headername</replaceable></arg>
- <arg><replaceable>value</replaceable></arg>
- </cmdsynopsis>
- </term>
- <listitem>
- <para>Add text to header
- <varname>headername</varname>.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
- <cmdsynopsis>
- <command>::rivet::headers</command>
- <arg choice="plain">type</arg>
- <arg><replaceable>content-type</replaceable></arg>
- </cmdsynopsis>
- </term>
- <listitem>
- <para>
- This command sets the <constant>Content-type</constant>
- header returned by the script, which is useful if you wish
- to send content other than HTML with Rivet - PNG or jpeg
- images, for example.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
- <cmdsynopsis>
- <command>::rivet::headers</command>
- <arg choice="plain">numeric</arg>
- <arg><replaceable>response code</replaceable></arg>
- </cmdsynopsis>
- </term>
- <listitem>
- <para>
- Set a numeric response code, such as 200, 404 or 500.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
+ <variablelist>
+
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>::rivet::headers</command>
+ <arg choice="plain">get</arg>
+ <arg><replaceable>headername</replaceable></arg>
+ <arg><replaceable>value</replaceable></arg>
+ </cmdsynopsis>
+ </term>
+ <listitem>
+ <para>
+ Read arbitrary header names and values from output HTTP headers
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>::rivet::headers</command>
+ <arg choice="plain">set</arg>
+ <arg><replaceable>headername</replaceable></arg>
+ <arg><replaceable>value</replaceable></arg>
+ </cmdsynopsis>
+ </term>
+ <listitem>
+ <para>
+ Set arbitrary header names and values into output HTTP headers
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>::rivet::headers</command>
+ <arg choice="plain">sent</arg>
+ </cmdsynopsis>
+ </term>
+ <listitem>
+ <para>
+ Test internal status of the module and returns 1
+ if the HTTP headers have been already sent
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>::rivet::headers</command>
+ <arg choice="plain">redirect</arg>
+ <arg><replaceable>uri</replaceable></arg>
+ </cmdsynopsis>
+ </term>
+ <listitem>
+ <para>
+ Redirect from the current page to a
+ new URI. <emphasis>Must</emphasis> be
+ done in the first block of TCL code.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>::rivet::headers</command>
+ <arg choice="plain">add</arg>
+ <arg><replaceable>headername</replaceable></arg>
+ <arg><replaceable>value</replaceable></arg>
+ </cmdsynopsis>
+ </term>
+ <listitem>
+ <para>Add text to header
+ <varname>headername</varname>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>::rivet::headers</command>
+ <arg choice="plain">type</arg>
+ <arg><replaceable>content-type</replaceable></arg>
+ </cmdsynopsis>
+ </term>
+ <listitem>
+ <para>
+ This command sets the <constant>Content-type</constant>
+ header returned by the script, which is useful if you wish
+ to send content other than HTML with Rivet - PNG or jpeg
+ images, for example.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <cmdsynopsis>
+ <command>::rivet::headers</command>
+ <arg choice="plain">numeric</arg>
+ <arg><replaceable>response code</replaceable></arg>
+ </cmdsynopsis>
+ </term>
+ <listitem>
+ <para>
+ Set a numeric response code, such as 200, 404 or 500.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</refsect1>
</refentry>
Modified: tcl/rivet/trunk/src/experimental/TclWebapache.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/TclWebapache.c?rev=1650415&r1=1650414&r2=1650415&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/TclWebapache.c (original)
+++ tcl/rivet/trunk/src/experimental/TclWebapache.c Thu Jan 8 23:06:14 2015
@@ -179,12 +179,12 @@ TclWeb_PrintError(CONST84 char *errstr,
if (errstr != NULL)
{
- if (htmlflag != 1)
- {
- ap_rputs(ap_escape_html(TCLWEBPOOL, errstr), req->req);
- } else {
- ap_rputs(errstr, req->req);
- }
+ if (htmlflag != 1)
+ {
+ ap_rputs(ap_escape_html(TCLWEBPOOL, errstr), req->req);
+ } else {
+ ap_rputs(errstr, req->req);
+ }
}
if (htmlflag != 1)
ap_rputs(ER2, req->req);
@@ -220,14 +220,12 @@ TclWeb_OutputHeaderSet(char *header, cha
apr_table_set(req->req->headers_out, header, val);
}
-
INLINE const char*
TclWeb_OutputHeaderGet(char *header, TclWebRequest *req)
{
return apr_table_get(req->req->headers_out, header);
}
-
INLINE int
TclWeb_HeaderAdd(char *header, char *val, TclWebRequest *req)
{
@@ -245,8 +243,8 @@ TclWeb_SetStatus(int status, TclWebReque
INLINE int
TclWeb_MakeURL(Tcl_Obj *result, char *filename, TclWebRequest *req)
{
- Tcl_SetStringObj(result, ap_construct_url(TCLWEBPOOL,
- filename, req->req), -1);
+ Tcl_SetStringObj(result,
+ ap_construct_url(TCLWEBPOOL,filename,req->req),-1);
return TCL_OK;
}
Modified: tcl/rivet/trunk/src/experimental/rivetCore.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/rivetCore.c?rev=1650415&r1=1650414&r2=1650415&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/rivetCore.c (original)
+++ tcl/rivet/trunk/src/experimental/rivetCore.c Thu Jan 8 23:06:14 2015
@@ -393,12 +393,17 @@ TCL_CMD_HEADER( Rivet_Headers )
}
else if (!strcmp("get", opt)) /* ### get ### */
{
+ const char* header_value;
+
if (objc != 3)
{
Tcl_WrongNumArgs(interp, 2, objv, "headername");
return TCL_ERROR;
}
- Tcl_SetObjResult(interp,Tcl_NewStringObj(TclWeb_OutputHeaderGet(Tcl_GetString(objv[2]), globals->req),-1));
+
+ header_value = TclWeb_OutputHeaderGet(Tcl_GetString(objv[2]),globals->req);
+
+ Tcl_SetObjResult(interp,Tcl_NewStringObj(header_value ? header_value : "",-1));
}
else if (!strcmp("set", opt)) /* ### set ### */
{
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org