httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@organic.com>
Subject version compatibility
Date Thu, 08 Aug 1996 01:10:23 GMT
Hmm..

It struck me a few weeks ago that, with each release of Apache, we tend to
change around things in the API. We change the way structures are
organized, their lengths, sometimes functions get changed in similar ways.
(witness that, in the current code for example, spawn_child is no longer a
function, but a cpp macro).

While most of these changes are source-compatible with past and future
versions of Apache, they are not binary-compatible. What I mean by this is
that if someone is dynmically loading a module, a module compiled under,
say 1.0.5, will not run under 1.1.1.

This in and of itself is not a bad thing; one of the things Brian wants to
do for 2.0, I know, is to make dynamic loading more of a real, portable,
possibility, and we'll have to look into all this then, but for now,
there's nothing really wrong with someone having to release a new version
of a dynmically loaded module when a new release of Apache comes out (it
doesn't happen all that often).

What is a bad thing is that Apache doesn't realize this. In other words,
it happily allows someone to load a module that may have been designed for
an older or newer version of Apache. These modules might actually load
okay, but its pretty much guaranteed that they will, because they think
structures are different than they are, seg fault at some point, probably
if they try to handle a request.

While changing this is, as I said, a more long-term project, preventing it
is a very simple prospect. Following this document is a patch that should
at least alert people that their modules are out-of-date, and will prevent
them from running them. Just so I'm clear, this should not affect source
files, just object files. In other words, a module written a year ago for
Apache 0.8.15 will probably still work fine under 1.1.1 and 1.2. However,
an object file that was compiled for 0.8.15, if you attempt to load it
under 1.1.1, will most probably fail dismally, and this patch simply makes
it so it failes cleanly instead of messily.

Here's the patch:

Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.17
diff -c -r1.17 http_config.c
*** http_config.c	1996/07/27 17:18:25	1.17
--- http_config.c	1996/08/08 01:02:22
***************
*** 362,367 ****
--- 362,379 ----
       * teased out...
       */
  
+     /* At some point, we may want to offer back-compatibility for
+      * loading modules that are for older versions of Apache. For now,
+      * though, we don't.
+      */
+ 
+     if (m->version != MODULE_MAGIC_NUMBER) {
+ 	fprintf(stderr, "httpd: module \"%s\" is not compatible with this "
+ 		        "version of Apache.\n", m->name);
+ 	fprintf(stderr, "Please contact the author for the correct version.\n");
+ 	exit(1);
+     }
+ 
      m->next = top_module;
      top_module = m;
      m->module_index = num_modules++;


-- Alexei Kosut <akosut@organic.com>            The Apache HTTP Server 
   http://www.nueva.pvt.k12.ca.us/~akosut/      http://www.apache.org/


Mime
View raw message