[mod_python] mod_python with apache 2.2.0 is not working

Jorey Bump list at joreybump.com
Mon Dec 5 09:37:56 EST 2005


T.Schneider at livingliquid wrote:
> hi list,
> 
> i compiled today mod_python with the new apache 2.2.0 but it is not 
> working.
> if i load the module i get the following error message:
> 
> -- 
> httpd: Syntax error on line 100 of /usr/local/apache2/conf/httpd.conf:
> Cannot load /usr/local/apache2/modules/mod_python.so into server:
> /usr/local/apache2/modules/mod_python.so: undefined symbol:
> APR_STATUS_IS_SUCCESS

I've attached a source tree patch against 3.2.5b that identifies and, in 
some cases, *bypasses* some of the issues that prevent mod_python from 
operating with apache 2.2.0. IT IS NOT A FIX, but may be useful to help 
with the related discussion on the mod_python developer's list, python-dev.

The changes are small. The test suite will still fail, possibly related 
to the patch, but Apache 2.2.0 will now be able to load and run 
mod_python. Please try out your applications against it, and send any 
useful information/observations to python-dev. Consider the patch to be 
unsuitable for production use until a proper version is released that is 
backwards-compatible with Apache 2.0.x, restores all functionality, and 
passes all tests in the test suite. YOU HAVE BEEN WARNED.

To apply the patch, move into the source code directory and issue the 
following command:

   patch -p1 < /path/to/mod_python-3.2.5b.patch

-------------- next part --------------
diff -uNr mod_python-3.2.5b/src/connobject.c mod_python-3.2.5b.new/src/connobject.c
--- mod_python-3.2.5b/src/connobject.c	2005-11-12 13:59:35.000000000 -0500
+++ mod_python-3.2.5b.new/src/connobject.c	2005-12-03 15:26:27.000000000 -0500
@@ -78,12 +78,6 @@
     rc = ap_get_brigade(c->input_filters, bb, mode, APR_BLOCK_READ, bufsize);
     Py_END_ALLOW_THREADS;
 
-    if (! APR_STATUS_IS_SUCCESS(rc)) {
-        PyErr_SetObject(PyExc_IOError, 
-                        PyString_FromString("Connection read error"));
-        return NULL;
-    }
-
     /* 
      * loop through the brigade reading buckets into the string 
      */
@@ -312,24 +306,17 @@
  **
  *  utility func to make a socket address
  */
-
 static PyObject *makesockaddr(struct apr_sockaddr_t *addr)
-{
+{   
     PyObject *addrobj = makeipaddr(addr);
     PyObject *ret = NULL;
     if (addrobj) {
-        apr_port_t port;
-        if(apr_sockaddr_port_get(&port, addr)==APR_SUCCESS) {
-            ret = Py_BuildValue("Oi", addrobj, port );
-        }
-        else {
-            PyErr_SetString(PyExc_SystemError,"apr_sockaddr_port_get failure");
-        }
+        ret = Py_BuildValue("Oi", addrobj, ntohs(addr->sa.sin.sin_port));
         Py_DECREF(addrobj);
     }
     return ret;
 }
-
+    
 /**
  ** conn_getattr
  **
diff -uNr mod_python-3.2.5b/src/filterobject.c mod_python-3.2.5b.new/src/filterobject.c
--- mod_python-3.2.5b/src/filterobject.c	2004-11-25 17:10:52.000000000 -0500
+++ mod_python-3.2.5b.new/src/filterobject.c	2005-12-03 14:20:29.000000000 -0500
@@ -178,11 +178,6 @@
                                   APR_BLOCK_READ, self->readbytes);
         Py_END_ALLOW_THREADS;
 
-        if (!APR_STATUS_IS_EAGAIN(self->rc) && !APR_STATUS_IS_SUCCESS(self->rc)) {
-            PyErr_SetObject(PyExc_IOError, 
-                            PyString_FromString("Input filter read error"));
-            return NULL;
-        }
     }
 
     /* 
diff -uNr mod_python-3.2.5b/test/test.py mod_python-3.2.5b.new/test/test.py
--- mod_python-3.2.5b/test/test.py	2005-11-14 13:09:49.000000000 -0500
+++ mod_python-3.2.5b.new/test/test.py	2005-12-03 14:23:45.000000000 -0500
@@ -242,9 +242,9 @@
             PythonOption('PythonOptionTest sample_value'),
             DocumentRoot(DOCUMENT_ROOT),
             LoadModule("python_module %s" % MOD_PYTHON_SO),
-            IfModule("!mod_auth.c",
-                     LoadModule("auth_module %s" %
-                                quoteIfSpace(os.path.join(modpath, "mod_auth.so")))))
+            IfModule("!mod_auth_basic.c",
+                     LoadModule("auth_basic_module %s" %
+                                quoteIfSpace(os.path.join(modpath, "mod_auth_basic.so")))))
 
         f = open(CONFIG, "w")
         f.write(str(s))


More information about the Mod_python mailing list