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 2014/12/22 00:16:37 UTC
svn commit: r1647223 - in /tcl/rivet/trunk: ChangeLog
rivet/rivet-tcl/redirect.tcl src/TclWeb.h src/experimental/TclWebapache.c
src/experimental/mod_rivet.h src/experimental/rivetCore.c
Author: mxmanghi
Date: Sun Dec 21 23:16:36 2014
New Revision: 1647223
URL: http://svn.apache.org/r1647223
Log:
* rivet/rivet-tcl/redirect.tcl: passing a meaningful dictionary as error descriptor
* src/experimental/rivetCore.c: supporting also method 'get'
* src/experimental/Tclwebapache.c: new function TclWeb_OutputHeader[Get|Set] to
explicitly suggesting they are accessing the output headers
Modified:
tcl/rivet/trunk/ChangeLog
tcl/rivet/trunk/rivet/rivet-tcl/redirect.tcl
tcl/rivet/trunk/src/TclWeb.h
tcl/rivet/trunk/src/experimental/TclWebapache.c
tcl/rivet/trunk/src/experimental/mod_rivet.h
tcl/rivet/trunk/src/experimental/rivetCore.c
Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1647223&r1=1647222&r2=1647223&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Sun Dec 21 23:16:36 2014
@@ -1,3 +1,9 @@
+2014-12-21 Massimo Manghi <mx...@apache.org>
+ * rivet/rivet-tcl/redirect.tcl: passing a meaningful dictionary as error descriptor
+ * src/experimental/rivetCore.c: supporting also method 'get'
+ * src/experimental/Tclwebapache.c: new function TclWeb_OutputHeader[Get|Set] to
+ explicitly suggesting they are accessing the output headers
+
2014-12-17 Massimo Manghi <mx...@apache.org>
* src/experimental/rivetCore.c: new 'headers sent' introspection command to
understand whether headers have been sent already
Modified: tcl/rivet/trunk/rivet/rivet-tcl/redirect.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/rivet-tcl/redirect.tcl?rev=1647223&r1=1647222&r2=1647223&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/rivet-tcl/redirect.tcl (original)
+++ tcl/rivet/trunk/rivet/rivet-tcl/redirect.tcl Sun Dec 21 23:16:36 2014
@@ -25,7 +25,7 @@ namespace eval ::rivet {
::rivet::no_body ; ## donât output anything on a redirect
::rivet::headers set Location $url
::rivet::headers numeric [expr {$permanent ? "301" : "302"}]
- ::rivet::abort_page ; ## stop any further processing
+ ::rivet::abort_page [dict create error_code redirect location $url] ; ## stop any further processing
return -error ok
}
Modified: tcl/rivet/trunk/src/TclWeb.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/TclWeb.h?rev=1647223&r1=1647222&r2=1647223&view=diff
==============================================================================
--- tcl/rivet/trunk/src/TclWeb.h (original)
+++ tcl/rivet/trunk/src/TclWeb.h Sun Dec 21 23:16:36 2014
@@ -81,7 +81,9 @@ int TclWeb_PrintError(CONST84 char *errs
*-----------------------------------------------------------------------------
*/
-int TclWeb_HeaderSet(char *header, char *val, TclWebRequest *req);
+int TclWeb_HeaderSet(char *header, char *val, TclWebRequest *req);
+void TclWeb_OutputHeaderSet(char *header, char *val, TclWebRequest *req);
+const char* TclWeb_OutputHeaderGet(char *header, TclWebRequest *req);
/*
*-----------------------------------------------------------------------------
Modified: tcl/rivet/trunk/src/experimental/TclWebapache.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/TclWebapache.c?rev=1647223&r1=1647222&r2=1647223&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/TclWebapache.c (original)
+++ tcl/rivet/trunk/src/experimental/TclWebapache.c Sun Dec 21 23:16:36 2014
@@ -199,6 +199,35 @@ TclWeb_HeaderSet(char *header, char *val
return TCL_OK;
}
+/* * accessing output headers *
+ *
+ * -- TclWeb_OutputHeaderSet: replicates the role of TclWeb_HeaderSet
+ *
+ * - the name stresses the fact it's an accessor to the output
+ * headers
+ * - it returns nothing since it's a wrapper around an APR call
+ * that doesn't return anything
+ *
+ * -- TclWeb_OutputHeaderGet: reads from the output headers and
+ * returns the value associated to a key. If the key is not
+ * existing it returns NULL
+ *
+ */
+
+INLINE void
+TclWeb_OutputHeaderSet(char *header, char *val, TclWebRequest *req)
+{
+ 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)
{
Modified: tcl/rivet/trunk/src/experimental/mod_rivet.h
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/mod_rivet.h?rev=1647223&r1=1647222&r2=1647223&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/mod_rivet.h (original)
+++ tcl/rivet/trunk/src/experimental/mod_rivet.h Sun Dec 21 23:16:36 2014
@@ -338,7 +338,10 @@ EXTERN Tcl_Interp* Rivet_CreateTclInterp
#define HTTP_REQUESTS_PROC(request_proc_call) request_proc_call;
#endif
-/* avoids unnecessary verbosity of repetitive code in functions
+/*
+ * RIVET_CONF_SELECT:
+ *
+ * This macro avoids unnecessary verbosity of repetitive code in functions
* overlaying and merging configuration records
*/
Modified: tcl/rivet/trunk/src/experimental/rivetCore.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/experimental/rivetCore.c?rev=1647223&r1=1647222&r2=1647223&view=diff
==============================================================================
--- tcl/rivet/trunk/src/experimental/rivetCore.c (original)
+++ tcl/rivet/trunk/src/experimental/rivetCore.c Sun Dec 21 23:16:36 2014
@@ -391,6 +391,15 @@ TCL_CMD_HEADER( Rivet_Headers )
TclWeb_SetStatus(301, globals->req);
return TCL_OK;
}
+ else if (!strcmp("get", opt)) /* ### get ### */
+ {
+ 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));
+ }
else if (!strcmp("set", opt)) /* ### set ### */
{
if (objc != 4)
---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org