Hi guys,

I've been trying to port some of the c-modules to Apache 1.3, and before I
go any further I thought I'd check that I haven't done anything stupid :-)
Attached to the bottom is my patch to mod_random_chunk; I haven't managed
to test it fully since my LWP is too old (is 5.5396 a CVS version?) but I
just wanted to see if anyone has any problems with what I've done to make
it work? I'm not too familiar with Apache's internals...

Also, in cmodules_httpd_conf(), in TestConfigC.pm, it is looking for the
compiled module in "$dir/.libs/$mod->{name}.so", whereas on mine the
module gets compiled to "$dir/$mod->{name}.so"; is this another Apache 2
thing? Would this be an appropriate fix:

my $so = $self->{server}->{rev} == 1 ?
         "$dir/$mod->{name}.so" :
         "$dir/.libs/$mod->{name}.so";

Cheers,
Gary

[ Gary Benson, Red Hat Europe ][ [EMAIL PROTECTED] ][ GnuPG 60E8793A ]



Index: perl-framework/c-modules/random_chunk/mod_random_chunk.c
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/c-modules/random_chunk/mod_random_chunk.c,v
retrieving revision 1.4
diff -u -r1.4 mod_random_chunk.c
--- perl-framework/c-modules/random_chunk/mod_random_chunk.c    2001/08/27 
04:59:40     1.4
+++ perl-framework/c-modules/random_chunk/mod_random_chunk.c    2001/09/07 
17:11:37
@@ -1,5 +1,3 @@
-#define HTTPD_TEST_REQUIRE_APACHE 2
-
 #if CONFIG_FOR_HTTPD_TEST

 <Location /random_chunk>
@@ -100,6 +98,11 @@
 #define MAX_SEGMENT     32
 #define ONE_WEIGHT      (256-32)

+#ifdef APACHE1
+#define AP_METHOD_BIT  1
+typedef size_t apr_size_t;
+#endif /* APACHE1 */
+
 static int random_chunk_handler(request_rec *r)
 {
     const char *args;
@@ -176,6 +179,8 @@
     return 0;
 }

+#ifdef APACHE2
+
 static void random_chunk_register_hooks(apr_pool_t *p)
 {
     ap_hook_handler(random_chunk_handler, NULL, NULL, APR_HOOK_MIDDLE);
@@ -190,3 +195,38 @@
     NULL,                  /* table of config file commands       */
     random_chunk_register_hooks  /* register hooks                      */
 };
+
+#endif /* APACHE2 */
+
+#ifdef APACHE1
+
+static const handler_rec random_chunk_handlers[] =
+{
+    {"random-chunk", random_chunk_handler},
+    {NULL}
+};
+
+module MODULE_VAR_EXPORT random_chunk_module =
+{
+    STANDARD_MODULE_STUFF,
+    NULL,                      /* initializer */
+    NULL,                      /* create per-directory config structure */
+    NULL,                      /* merge per-directory config structures */
+    NULL,                      /* create per-server config structure */
+    NULL,                      /* merge per-server config structures */
+    NULL,                      /* command table */
+    random_chunk_handlers,     /* handlers */
+    NULL,                      /* translate_handler */
+    NULL,                      /* check_user_id */
+    NULL,                      /* check auth */
+    NULL,                      /* check access */
+    NULL,                      /* type_checker */
+    NULL,                      /* pre-run fixups */
+    NULL,                      /* logger */
+    NULL,                      /* header parser */
+    NULL,                      /* child_init */
+    NULL,                      /* child_exit */
+    NULL                       /* post read-request */
+};
+
+#endif /* APACHE1 */

Reply via email to