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 Massimo Manghi <ma...@unipr.it> on 2010/04/23 17:28:25 UTC
patches for apache 1
Some recent and also less recent additions to the code for apache2
(e.g. upload tempname ...) hadn't been ported to the apache1tree yet.
It was a chance for me also to review this part of the project, compile
and run it against apache 1.3.42.
if no-one objects within three days, I'll assume lazy consensus and
commit it
-- Massimo
Index: src/apache-1/TclWebapache.c
===================================================================
--- src/apache-1/TclWebapache.c (revision 937313)
+++ src/apache-1/TclWebapache.c (working copy)
@@ -26,7 +26,7 @@
/* Rivet config */
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <rivet_config.h>
#endif
#include <tcl.h>
@@ -537,6 +537,14 @@
}
}
+int TclWeb_UploadTempname(Tcl_Obj *tempname, TclWebRequest *req)
+{
+ Tcl_SetStringObj(tempname,
+ TclWeb_StringToUtf(req->upload->tempname,
+ req), -1);
+ return TCL_OK;
+}
+
int TclWeb_UploadSave(char *varname, Tcl_Obj *filename, TclWebRequest *req)
{
int sz;
Index: src/apache-1/rivetCore.c
===================================================================
--- src/apache-1/rivetCore.c (revision 937313)
+++ src/apache-1/rivetCore.c (working copy)
@@ -21,7 +21,7 @@
/* Rivet config */
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <rivet_config.h>
#endif
#include "httpd.h"
@@ -47,6 +47,7 @@
#define COOKIES_ARRAY_NAME "cookies"
extern module rivet_module;
+extern char* TclWeb_GetRawPost (TclWebRequest *req);
#define POOL (globals->r->pool)
@@ -578,6 +579,7 @@
"size",
"type",
"filename",
+ "tempname",
"names",
NULL
};
@@ -590,24 +592,26 @@
SIZE,
TYPE,
FILENAME,
+ TEMPNAME,
NAMES
};
rivet_interp_globals *globals = Tcl_GetAssocData(interp, "rivet",
NULL);
command = Tcl_GetString(objv[1]);
Tcl_GetIndexFromObj(interp, objv[1], SubCommand,
- "channel|save|data|exists|size|type|filename|names",
+ "channel|save|data|exists|size|type|filename|tempname|names",
0, &subcommandindex);
/* If it's any of these, we need to find a specific name. */
- /* Excluded cases are EXISTS and NAMES. */
- if ((enum subcommand)subcommandindex == CHANNEL ||
- (enum subcommand)subcommandindex == SAVE ||
- (enum subcommand)subcommandindex == DATA ||
- (enum subcommand)subcommandindex == EXISTS ||
- (enum subcommand)subcommandindex == SIZE ||
- (enum subcommand)subcommandindex == TYPE ||
+ /* Excluded case is NAMES. */
+ if ((enum subcommand)subcommandindex == CHANNEL ||
+ (enum subcommand)subcommandindex == SAVE ||
+ (enum subcommand)subcommandindex == DATA ||
+ (enum subcommand)subcommandindex == EXISTS ||
+ (enum subcommand)subcommandindex == SIZE ||
+ (enum subcommand)subcommandindex == TYPE ||
+ (enum subcommand)subcommandindex == TEMPNAME ||
(enum subcommand)subcommandindex == FILENAME)
{
varname = Tcl_GetString(objv[2]);
@@ -686,6 +690,9 @@
}
TclWeb_UploadNames(result, globals->req);
break;
+ case TEMPNAME:
+ TclWeb_UploadTempname(result,globals->req);
+ break;
default:
Tcl_WrongNumArgs(interp, 1, objv,
"channel|save ?name?|data|exists|size|type|filename|names");
Index: src/apache-1/mod_rivet.c
===================================================================
--- src/apache-1/mod_rivet.c (revision 937313)
+++ src/apache-1/mod_rivet.c (working copy)
@@ -17,7 +17,7 @@
/* Rivet config */
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <rivet_config.h>
#endif
/* Apache includes */
@@ -752,8 +752,7 @@
/* Create TCL commands to deal with Apache's BUFFs. */
rsc->outchannel = ap_pcalloc(p, sizeof(Tcl_Channel));
- *(rsc->outchannel) = Tcl_CreateChannel(&RivetChan, "apacheout", rsc,
- TCL_WRITABLE);
+ *(rsc->outchannel) = Tcl_CreateChannel(&RivetChan, "apacheout",
rsc, TCL_WRITABLE);
Tcl_SetStdChannel(*(rsc->outchannel), TCL_STDOUT);
@@ -782,7 +781,7 @@
* links a specific installation to RivetTcl's version
*/
- if (Tcl_EvalFile(interp,RIVETLIB_DESTDIR"/init.tcl") == TCL_ERROR) {
+ if (Tcl_EvalFile(interp,RIVET_RIVETLIB_DESTDIR"/init.tcl") ==
TCL_ERROR) {
ap_log_error( APLOG_MARK, APLOG_ERR, s,
"init.tcl must be installed correctly for Apache Rivet to
function: %s",
Tcl_GetStringResult(interp) );
@@ -858,7 +857,7 @@
server_rec *sr;
/* Initialize TCL stuff */
- Tcl_FindExecutable(NAMEOFEXECUTABLE);
+ Tcl_FindExecutable(RIVET_NAMEOFEXECUTABLE);
interp = Tcl_CreateInterp();
if (interp == NULL)
@@ -1534,13 +1533,13 @@
MODULE_VAR_EXPORT void
-Rivet_InitHandler(server_rec *s, pool *p)
+Rivet_InitHandler(server_rec *s, pool *pPool)
{
-#ifndef HIDE_RIVET_VERSION
- ap_add_version_component("Rivet/"VERSION);
+#if RIVET_DISPLAY_VERSION
+ ap_add_version_component(RIVET_PACKAGE_NAME"/"RIVET_PACKAGE_VERSION);
#else
- ap_add_version_component("Rivet");
-#endif /* !HIDE_RIVET_VERSION */
+ ap_add_version_component(RIVET_PACKAGE_NAME);
+#endif /* RIVET_DISPLAY_VERSION */
}
const handler_rec rivet_handlers[] =
Index: src/apache-1/apache_request.c
===================================================================
--- src/apache-1/apache_request.c (revision 937313)
+++ src/apache-1/apache_request.c (working copy)
@@ -316,7 +316,7 @@
return OK;
}
-static int urlword_dlm[] = {'&', ';', 0};
+// static int urlword_dlm[] = {'&', ';', 0};
static char *my_urlword(pool *p, const char **line)
{
@@ -409,7 +409,7 @@
return rc;
}
if (data) {
- req->raw_post = data; /* Give people a way of getting at the
raw data. */
+ req->raw_post = (char *) data; /* Give people a way of getting
at the raw data. */
split_to_parms(req, data);
}
}
Index: src/apache-1/apache_multipart_buffer.c
===================================================================
--- src/apache-1/apache_multipart_buffer.c (revision 937313)
+++ src/apache-1/apache_multipart_buffer.c (working copy)
@@ -17,7 +17,7 @@
/* Rivet config */
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <rivet_config.h>
#endif
#include "apache_multipart_buffer.h"
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org
Re: patches for apache 1
Posted by Karl Lehenbauer <ka...@gmail.com>.
Works for me. Awesome, Massimo… Apache announced the last release of 1.3 in February, although it is probably a good idea to support it for at least a few more months, perhaps a year.
On Apr 23, 2010, at 10:28 AM, Massimo Manghi wrote:
>
> Some recent and also less recent additions to the code for apache2 (e.g. upload tempname ...) hadn't been ported to the apache1tree yet.
> It was a chance for me also to review this part of the project, compile and run it against apache 1.3.42.
>
> if no-one objects within three days, I'll assume lazy consensus and commit it
>
> -- Massimo
>
>
> Index: src/apache-1/TclWebapache.c
> ===================================================================
> --- src/apache-1/TclWebapache.c (revision 937313)
> +++ src/apache-1/TclWebapache.c (working copy)
> @@ -26,7 +26,7 @@
> /* Rivet config */
> #ifdef HAVE_CONFIG_H
> -#include <config.h>
> +#include <rivet_config.h>
> #endif
> #include <tcl.h>
> @@ -537,6 +537,14 @@
> }
> }
> +int TclWeb_UploadTempname(Tcl_Obj *tempname, TclWebRequest *req)
> +{
> + Tcl_SetStringObj(tempname,
> + TclWeb_StringToUtf(req->upload->tempname,
> + req), -1);
> + return TCL_OK;
> +}
> +
> int TclWeb_UploadSave(char *varname, Tcl_Obj *filename, TclWebRequest *req)
> {
> int sz;
> Index: src/apache-1/rivetCore.c
> ===================================================================
> --- src/apache-1/rivetCore.c (revision 937313)
> +++ src/apache-1/rivetCore.c (working copy)
> @@ -21,7 +21,7 @@
> /* Rivet config */
> #ifdef HAVE_CONFIG_H
> -#include <config.h>
> +#include <rivet_config.h>
> #endif
> #include "httpd.h"
> @@ -47,6 +47,7 @@
> #define COOKIES_ARRAY_NAME "cookies"
> extern module rivet_module;
> +extern char* TclWeb_GetRawPost (TclWebRequest *req);
> #define POOL (globals->r->pool)
> @@ -578,6 +579,7 @@
> "size",
> "type",
> "filename",
> + "tempname",
> "names",
> NULL
> };
> @@ -590,24 +592,26 @@
> SIZE,
> TYPE,
> FILENAME,
> + TEMPNAME,
> NAMES
> };
> rivet_interp_globals *globals = Tcl_GetAssocData(interp, "rivet", NULL);
> command = Tcl_GetString(objv[1]);
> Tcl_GetIndexFromObj(interp, objv[1], SubCommand,
> - "channel|save|data|exists|size|type|filename|names",
> + "channel|save|data|exists|size|type|filename|tempname|names",
> 0, &subcommandindex);
> /* If it's any of these, we need to find a specific name. */
> - /* Excluded cases are EXISTS and NAMES. */
> - if ((enum subcommand)subcommandindex == CHANNEL ||
> - (enum subcommand)subcommandindex == SAVE ||
> - (enum subcommand)subcommandindex == DATA ||
> - (enum subcommand)subcommandindex == EXISTS ||
> - (enum subcommand)subcommandindex == SIZE ||
> - (enum subcommand)subcommandindex == TYPE ||
> + /* Excluded case is NAMES. */
> + if ((enum subcommand)subcommandindex == CHANNEL ||
> + (enum subcommand)subcommandindex == SAVE ||
> + (enum subcommand)subcommandindex == DATA ||
> + (enum subcommand)subcommandindex == EXISTS ||
> + (enum subcommand)subcommandindex == SIZE ||
> + (enum subcommand)subcommandindex == TYPE ||
> + (enum subcommand)subcommandindex == TEMPNAME ||
> (enum subcommand)subcommandindex == FILENAME)
> {
> varname = Tcl_GetString(objv[2]);
> @@ -686,6 +690,9 @@
> }
> TclWeb_UploadNames(result, globals->req);
> break;
> + case TEMPNAME:
> + TclWeb_UploadTempname(result,globals->req);
> + break;
> default:
> Tcl_WrongNumArgs(interp, 1, objv,
> "channel|save ?name?|data|exists|size|type|filename|names");
> Index: src/apache-1/mod_rivet.c
> ===================================================================
> --- src/apache-1/mod_rivet.c (revision 937313)
> +++ src/apache-1/mod_rivet.c (working copy)
> @@ -17,7 +17,7 @@
> /* Rivet config */
> #ifdef HAVE_CONFIG_H
> -#include <config.h>
> +#include <rivet_config.h>
> #endif
> /* Apache includes */
> @@ -752,8 +752,7 @@
> /* Create TCL commands to deal with Apache's BUFFs. */
> rsc->outchannel = ap_pcalloc(p, sizeof(Tcl_Channel));
> - *(rsc->outchannel) = Tcl_CreateChannel(&RivetChan, "apacheout", rsc,
> - TCL_WRITABLE);
> + *(rsc->outchannel) = Tcl_CreateChannel(&RivetChan, "apacheout", rsc, TCL_WRITABLE);
> Tcl_SetStdChannel(*(rsc->outchannel), TCL_STDOUT);
> @@ -782,7 +781,7 @@
> * links a specific installation to RivetTcl's version
> */
> - if (Tcl_EvalFile(interp,RIVETLIB_DESTDIR"/init.tcl") == TCL_ERROR) {
> + if (Tcl_EvalFile(interp,RIVET_RIVETLIB_DESTDIR"/init.tcl") == TCL_ERROR) {
> ap_log_error( APLOG_MARK, APLOG_ERR, s,
> "init.tcl must be installed correctly for Apache Rivet to function: %s",
> Tcl_GetStringResult(interp) );
> @@ -858,7 +857,7 @@
> server_rec *sr;
> /* Initialize TCL stuff */
> - Tcl_FindExecutable(NAMEOFEXECUTABLE);
> + Tcl_FindExecutable(RIVET_NAMEOFEXECUTABLE);
> interp = Tcl_CreateInterp();
> if (interp == NULL)
> @@ -1534,13 +1533,13 @@
> MODULE_VAR_EXPORT void
> -Rivet_InitHandler(server_rec *s, pool *p)
> +Rivet_InitHandler(server_rec *s, pool *pPool)
> {
> -#ifndef HIDE_RIVET_VERSION
> - ap_add_version_component("Rivet/"VERSION);
> +#if RIVET_DISPLAY_VERSION
> + ap_add_version_component(RIVET_PACKAGE_NAME"/"RIVET_PACKAGE_VERSION);
> #else
> - ap_add_version_component("Rivet");
> -#endif /* !HIDE_RIVET_VERSION */
> + ap_add_version_component(RIVET_PACKAGE_NAME);
> +#endif /* RIVET_DISPLAY_VERSION */
> }
> const handler_rec rivet_handlers[] =
> Index: src/apache-1/apache_request.c
> ===================================================================
> --- src/apache-1/apache_request.c (revision 937313)
> +++ src/apache-1/apache_request.c (working copy)
> @@ -316,7 +316,7 @@
> return OK;
> }
> -static int urlword_dlm[] = {'&', ';', 0};
> +// static int urlword_dlm[] = {'&', ';', 0};
> static char *my_urlword(pool *p, const char **line)
> {
> @@ -409,7 +409,7 @@
> return rc;
> }
> if (data) {
> - req->raw_post = data; /* Give people a way of getting at the raw data. */
> + req->raw_post = (char *) data; /* Give people a way of getting at the raw data. */
> split_to_parms(req, data);
> }
> }
> Index: src/apache-1/apache_multipart_buffer.c
> ===================================================================
> --- src/apache-1/apache_multipart_buffer.c (revision 937313)
> +++ src/apache-1/apache_multipart_buffer.c (working copy)
> @@ -17,7 +17,7 @@
> /* Rivet config */
> #ifdef HAVE_CONFIG_H
> -#include <config.h>
> +#include <rivet_config.h>
> #endif
> #include "apache_multipart_buffer.h"
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
> For additional commands, e-mail: rivet-dev-help@tcl.apache.org
>