You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jens-Uwe Mager <ju...@helios.de> on 2000/06/12 01:22:44 UTC

Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

mod_perl 1.24 recently started to use a global not previously exported
in Apache 1.3.12. The folloing patch enables mod_perl DSO build on AIX
again.
-- 
Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:		+49 5131 709320
FAX:		+49 5131 709325
Internet:	jum@helios.de

Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Eric Cholet <ch...@logilune.com>.
> > How about this patch to 1.3 HEAD:
>
> Since this is changing a visible structure, I think it would need
> to be a major bump.

Ok, here's the revised patch:

Index: src/include/ap_mmn.h
===================================================================
RCS file: /home/cvspublic/apache-1.3/src/include/ap_mmn.h,v
retrieving revision 1.46
diff -b -u -r1.46 ap_mmn.h
--- src/include/ap_mmn.h        2000/03/21 05:01:21     1.46
+++ src/include/ap_mmn.h        2000/06/19 13:21:29
@@ -228,14 +228,15 @@
  *                        ap_pbase64decode(), ap_pbase64encode()
  * 19990320.7           - add ap_strcasestr()
  * 19990320.8           - add request_rec.case_preserved_filename
+ * 20000619             - add configtestonly to cmd_parms
  */

 #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */

 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 19990320
+#define MODULE_MAGIC_NUMBER_MAJOR 20000619
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 8                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 0                     /* 0...n */
 #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR  /* backward compat
*/

 /* Useful for testing for features. */
Index: src/include/http_config.h
===================================================================
RCS file: /home/cvspublic/apache-1.3/src/include/http_config.h,v
retrieving revision 1.103
diff -b -u -r1.103 http_config.h
--- src/include/http_config.h   2000/06/01 23:42:23     1.103
+++ src/include/http_config.h   2000/06/19 13:21:33
@@ -172,6 +172,7 @@
     const char *end_token;     /* end token required to end a nested
section */
     void *context;             /* per_dir_config vector passed
                                 * to handle_command */
+    int configtestonly;         /* if using -t or -T command line option */
 } cmd_parms;

 /* This structure records the existence of handlers in a module... */
Index: src/main/http_config.c
===================================================================
RCS file: /home/cvspublic/apache-1.3/src/main/http_config.c,v
retrieving revision 1.153
diff -b -u -r1.153 http_config.c
--- src/main/http_config.c      2000/06/01 23:42:24     1.153
+++ src/main/http_config.c      2000/06/19 13:21:45
@@ -1169,6 +1169,7 @@
     parms.temp_pool = ptemp;
     parms.server = s;
     parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT);
+    parms.configtestonly = ap_configtestonly;
     parms.config_file = ap_pcfg_open_custom(p, "-c/-C directives",
                                          &arr_parms, NULL,
                                          arr_elts_getstr, arr_elts_close);
@@ -1215,6 +1216,7 @@
     parms.temp_pool = ptemp;
     parms.server = s;
     parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT);
+    parms.configtestonly = ap_configtestonly;

     if (!(parms.config_file = ap_pcfg_openfile(p,fname))) {
        perror("fopen");


Thanks,
--
Eric



Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Eric Cholet wrote:
> 
> How about this patch to 1.3 HEAD:

Since this is changing a visible structure, I think it would need
to be a major bump.
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>

Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Eric Cholet <ch...@logilune.com>.
> > > The only time a module should care about the config-test-only
> > > condition is when it's dealing with its directives.  And those
> > > are passed a cmd_parms argument, so they'd have access to the
> > > flag without exporting a global.

How about this patch to 1.3 HEAD:

Index: src/include/ap_mmn.h
===================================================================
RCS file: /home/cvspublic/apache-1.3/src/include/ap_mmn.h,v
retrieving revision 1.46
diff -b -u -r1.46 ap_mmn.h
--- src/include/ap_mmn.h        2000/03/21 05:01:21     1.46
+++ src/include/ap_mmn.h        2000/06/16 16:16:25
@@ -228,6 +228,7 @@
  *                        ap_pbase64decode(), ap_pbase64encode()
  * 19990320.7           - add ap_strcasestr()
  * 19990320.8           - add request_rec.case_preserved_filename
+ * 19990320.9           - add configtestonly to cmd_parms
  */

 #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */
@@ -235,7 +236,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 19990320
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 8                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 9                     /* 0...n */
 #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR  /* backward compat
*/

 /* Useful for testing for features. */
Index: src/include/http_config.h
===================================================================
RCS file: /home/cvspublic/apache-1.3/src/include/http_config.h,v
retrieving revision 1.103
diff -b -u -r1.103 http_config.h
--- src/include/http_config.h   2000/06/01 23:42:23     1.103
+++ src/include/http_config.h   2000/06/16 16:16:26
@@ -172,6 +172,7 @@
     const char *end_token;     /* end token required to end a nested
section */
     void *context;             /* per_dir_config vector passed
                                 * to handle_command */
+    int configtestonly;         /* if using -t or -T command line option */
 } cmd_parms;

 /* This structure records the existence of handlers in a module... */
Index: src/main/http_config.c
===================================================================
RCS file: /home/cvspublic/apache-1.3/src/main/http_config.c,v
retrieving revision 1.153
diff -b -u -r1.153 http_config.c
--- src/main/http_config.c      2000/06/01 23:42:24     1.153
+++ src/main/http_config.c      2000/06/16 16:16:30
@@ -1169,6 +1169,7 @@
     parms.temp_pool = ptemp;
     parms.server = s;
     parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT);
+    parms.configtestonly = ap_configtestonly;
     parms.config_file = ap_pcfg_open_custom(p, "-c/-C directives",
                                          &arr_parms, NULL,
                                          arr_elts_getstr, arr_elts_close);
@@ -1215,6 +1216,7 @@
     parms.temp_pool = ptemp;
     parms.server = s;
     parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT);
+    parms.configtestonly = ap_configtestonly;

     if (!(parms.config_file = ap_pcfg_openfile(p,fname))) {
        perror("fopen");


--
Eric




Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Doug MacEachern <do...@covalent.net>.
On Wed, 14 Jun 2000, Greg Stein wrote:
 
> Yes, you would need to check it in three places. It doesn't seem burdensome.
> 
>     if (cmd->config_test_only)
>       GvSV_setiv(GvSV_init("Apache::Server::ConfigTestOnly"), TRUE);
>       
> If you don't like copying that second line three times, then put that into a
> function or macro.
> 
> Global variables are a pain in the ass because of the strong coupling they
> introduce. In this case, there is a strong semantic association with
> cmd_parms, so it makes sense to place it there. That gives Apache much more
> flexibility on its side in the way it sets or clears that value.
> 
> It is interesting to note, that your code also makes it seem like the value
> would never change (i.e. setting only when true). Especially if you consider
> placing it into module_init. By placing it into cmd_parms, it allows Apache
> to run a pass with "config test only", followed by a real configuration
> pass.

ok, fine with me.  i backed out the change in mod_perl until this happens.
not only is the current implementation broken under win32 and aix, i've
had problem reports from older 1.3.x users and there's no mmn bump to
check for.  i'll leave it to eric (who originally added it) to sync with
whatever changes happen.


Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Jun 14, 2000 at 09:13:31AM -0700, Doug MacEachern wrote:
> On Wed, 14 Jun 2000, Rodent of Unusual Size wrote:
> > Eric Cholet wrote:
> > > cmd_parms, isn't that used to pass configuration data to
> > > directives? How would it be used in this case, ap_configtestonly
> > > is not tied to any directive?
> > 
> > The only time a module should care about the config-test-only
> > condition is when it's dealing with its directives.  And those
> > are passed a cmd_parms argument, so they'd have access to the
> > flag without exporting a global.
> 
> true, but then mod_perl would need to check that flag in 3 command
> handlers, <Perl>, PerlModule and PerlRequire.  whereas, with the global it
> can do a single check in module_init:
> 
>     if (ap_configtestonly)
>     	GvSV_setiv(GvSV_init("Apache::Server::ConfigTestOnly"), TRUE);
> 
> i would normally try to stay away from globals too, but it seems to make
> more sense in this particular case.

Yes, you would need to check it in three places. It doesn't seem burdensome.

    if (cmd->config_test_only)
      GvSV_setiv(GvSV_init("Apache::Server::ConfigTestOnly"), TRUE);
      
If you don't like copying that second line three times, then put that into a
function or macro.

Global variables are a pain in the ass because of the strong coupling they
introduce. In this case, there is a strong semantic association with
cmd_parms, so it makes sense to place it there. That gives Apache much more
flexibility on its side in the way it sets or clears that value.

It is interesting to note, that your code also makes it seem like the value
would never change (i.e. setting only when true). Especially if you consider
placing it into module_init. By placing it into cmd_parms, it allows Apache
to run a pass with "config test only", followed by a real configuration
pass.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Doug MacEachern <do...@covalent.net>.
On Wed, 14 Jun 2000, Rodent of Unusual Size wrote:

> Eric Cholet wrote:
> > 
> > cmd_parms, isn't that used to pass configuration data to
> > directives? How would it be used in this case, ap_configtestonly
> > is not tied to any directive?
> 
> The only time a module should care about the config-test-only
> condition is when it's dealing with its directives.  And those
> are passed a cmd_parms argument, so they'd have access to the
> flag without exporting a global.

true, but then mod_perl would need to check that flag in 3 command
handlers, <Perl>, PerlModule and PerlRequire.  whereas, with the global it
can do a single check in module_init:

    if (ap_configtestonly)
    	GvSV_setiv(GvSV_init("Apache::Server::ConfigTestOnly"), TRUE);

i would normally try to stay away from globals too, but it seems to make
more sense in this particular case.


Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Jun 14, 2000 at 09:55:43AM -0400, Rodent of Unusual Size wrote:
> Eric Cholet wrote:
> > 
> > cmd_parms, isn't that used to pass configuration data to
> > directives? How would it be used in this case, ap_configtestonly
> > is not tied to any directive?
> 
> The only time a module should care about the config-test-only
> condition is when it's dealing with its directives.  And those
> are passed a cmd_parms argument, so they'd have access to the
> flag without exporting a global.

*bing*

What he said. :-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Eric Cholet wrote:
> 
> cmd_parms, isn't that used to pass configuration data to
> directives? How would it be used in this case, ap_configtestonly
> is not tied to any directive?

The only time a module should care about the config-test-only
condition is when it's dealing with its directives.  And those
are passed a cmd_parms argument, so they'd have access to the
flag without exporting a global.
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>

Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Eric Cholet <ch...@logilune.com>.
> > Yes, ap_configtestonly's value is propagated to the mod_perl user so
that
> > Perl code in the configuration file (<Perl> sections, Perl startup code)
> > can avoid doing some operations when httpd is run with the -t option.
> > Thus the configuration can be tested for correctness without running
> > expensive or useless operations such as connecting to databases, etc.
>
> Ok, makes sense. I think the best way to export this to modules is to pass
> it through cmd_parms, rather than as a global.

cmd_parms, isn't that used to pass configuration data to directives? How
would
it be used in this case, ap_configtestonly is not tied to any directive?

--
Eric



Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Greg Stein <gs...@lyra.org>.
On Mon, Jun 12, 2000 at 12:16:54PM +0200, Eric Cholet wrote:
>...
> Yes, ap_configtestonly's value is propagated to the mod_perl user so that
> Perl code in the configuration file (<Perl> sections, Perl startup code)
> can avoid doing some operations when httpd is run with the -t option.
> Thus the configuration can be tested for correctness without running
> expensive or useless operations such as connecting to databases, etc.

Ok, makes sense. I think the best way to export this to modules is to pass
it through cmd_parms, rather than as a global.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Eric Cholet <ch...@logilune.com>.
On Mon, Jun 12, 2000 at 01:44:31AM +0200, Jens-Uwe Mager wrote:
> On Sun, Jun 11, 2000 at 04:32:34PM -0700, Greg Stein wrote:
> 
> > While I'm -0 with this tweak going into 1.3, I'm -1 for a similar change
> > in the 2.0 branch. I'd like to hear more about why this should be exported
> > for modules to examine.
> 
> Mod_perl uses it to export it to a global perl variable, here one could
> probably use it to provide better diagnostics in <Perl> config file
> sections. But Eric Cholet, who added the reference to mod_perl might be
> better able to explain it.

Yes, ap_configtestonly's value is propagated to the mod_perl user so that
Perl code in the configuration file (<Perl> sections, Perl startup code)
can avoid doing some operations when httpd is run with the -t option.
Thus the configuration can be tested for correctness without running
expensive or useless operations such as connecting to databases, etc.

If ap_configtestonly is to be correctly exported I'd like it to be under
Win32 too. 

-- 
Eric Cholet

Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Jens-Uwe Mager <ju...@helios.de>.
On Sun, Jun 11, 2000 at 04:32:34PM -0700, Greg Stein wrote:

> While I'm -0 with this tweak going into 1.3, I'm -1 for a similar change
> in the 2.0 branch. I'd like to hear more about why this should be exported
> for modules to examine.

Mod_perl uses it to export it to a global perl variable, here one could
probably use it to provide better diagnostics in <Perl> config file
sections. But Eric Cholet, who added the reference to mod_perl might be
better able to explain it.

-- 
Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:		+49 5131 709320
FAX:		+49 5131 709325
Internet:	jum@helios.de

Re: Again a symbol to add to httpd.exp for AIX and mod_perl 1.24

Posted by Greg Stein <gs...@lyra.org>.
While I'm -0 with this tweak going into 1.3, I'm -1 for a similar change
in the 2.0 branch. I'd like to hear more about why this should be exported
for modules to examine.

Cheers,
-g

On Mon, Jun 12, 2000 at 01:22:44AM +0200, Jens-Uwe Mager wrote:
> mod_perl 1.24 recently started to use a global not previously exported
> in Apache 1.3.12. The folloing patch enables mod_perl DSO build on AIX
> again.
> -- 
> Jens-Uwe Mager
> 
> HELIOS Software GmbH
> Steinriede 3
> 30827 Garbsen
> Germany
> 
> Phone:		+49 5131 709320
> FAX:		+49 5131 709325
> Internet:	jum@helios.de

> --- apache_1.3.12/src/support/httpd.exp.orig1	Mon Jun 12 01:01:11 2000
> +++ apache_1.3.12/src/support/httpd.exp	Mon Jun 12 01:01:53 2000
> @@ -74,6 +74,7 @@
>  ap_clear_pool
>  ap_clear_table
>  ap_close_piped_log
> +ap_configtestonly
>  ap_construct_server
>  ap_construct_url
>  ap_content_type_tolower


-- 
Greg Stein, http://www.lyra.org/