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:03:12 UTC
svn commit: r1650414 - in /tcl/rivet/branches/2.2: doc/xml/commands.xml
src/rivetcmds/rivetCore.c
Author: mxmanghi
Date: Thu Jan 8 23:03:12 2015
New Revision: 1650414
URL: http://svn.apache.org/r1650414
Log:
fixed missing test of NULL header values, last minutes changes in command headers documentation
Modified:
tcl/rivet/branches/2.2/doc/xml/commands.xml
tcl/rivet/branches/2.2/src/rivetcmds/rivetCore.c
Modified: tcl/rivet/branches/2.2/doc/xml/commands.xml
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/doc/xml/commands.xml?rev=1650414&r1=1650413&r2=1650414&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/doc/xml/commands.xml (original)
+++ tcl/rivet/branches/2.2/doc/xml/commands.xml Thu Jan 8 23:03:12 2015
@@ -580,6 +580,7 @@
<cmdsynopsis>
<command>::rivet::headers</command>
<group choice="req">
+ <arg>get</arg>
<arg>set</arg>
<arg>redirect</arg>
<arg>add</arg>
@@ -597,40 +598,72 @@
</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">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>
+ <varlistentry>
+ <term>
<cmdsynopsis>
- <command>::rivet::headers</command>
- <arg choice="plain">redirect</arg>
- <arg><replaceable>uri</replaceable></arg>
+ <command>::rivet::headers</command>
+ <arg choice="plain">set</arg>
+ <arg><replaceable>headername</replaceable></arg>
+ <arg><replaceable>value</replaceable></arg>
</cmdsynopsis>
- </term>
+ </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>
+ <para>
+ Set arbitrary header names and values into output HTTP headers
+ </para>
</listitem>
- </varlistentry>
+ </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>
+ <varlistentry>
<term>
<cmdsynopsis>
<command>::rivet::headers</command>
@@ -641,12 +674,12 @@
</term>
<listitem>
<para>Add text to header
- <varname>headername</varname>.
+ <varname>headername</varname>.
</para>
</listitem>
- </varlistentry>
+ </varlistentry>
- <varlistentry>
+ <varlistentry>
<term>
<cmdsynopsis>
<command>::rivet::headers</command>
Modified: tcl/rivet/branches/2.2/src/rivetcmds/rivetCore.c
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.2/src/rivetcmds/rivetCore.c?rev=1650414&r1=1650413&r2=1650414&view=diff
==============================================================================
--- tcl/rivet/branches/2.2/src/rivetcmds/rivetCore.c (original)
+++ tcl/rivet/branches/2.2/src/rivetcmds/rivetCore.c Thu Jan 8 23:03:12 2015
@@ -391,12 +391,16 @@ 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