[mod_python] Can't start Apache with mod_python

Jorey Bump list at joreybump.com
Mon Dec 19 20:29:00 EST 2005


Graham Dumpleton wrote:
> Apache 2.2 is not yet supported. See:
> 
>   http://issues.apache.org/jira/browse/MODPYTHON-78
> 
> Specfically, it links to a mailing list posts\ which suggests changes to make
> it work, but they need to be checked properly yet to see if they are correct.

I've attached the source tree patch. 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

As Graham points out, the patch is not thoroughly tested, but it does 
indicate where the problems are. Consider it not ready for production 
use. Note that some of the tests will fail, but Apache will load the 
module. I've tested it with Publisher, and it seems to work.


-------------- 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