I'll have to wait for the Win32 source code tree to be released to build it and test your patch. Hopefully it'll be out soon.

Is there a wait to use macro directives so that we don't need to maintain two separate branches ? A define that we could pass when building mod_python to select the Apache version we're building against, maybe ?

Regards,
Nicolas

2005/12/3, Jorey Bump <[EMAIL PROTECTED]>:
Nicolas Lehuen wrote:
> http://httpd.apache.org/download.cgi
>
> "Apache 2.2 add-in modules are not compatible with Apache 2.0 or 1.3
> modules. If you are running third party add-in modules, you will need to
> obtain new modules written for Apache 2.2 from that third party before
> you attempt to upgrade from Apache 2.0."
>
> Great, now we're having to support three separate version : mod_python
> 2.7 for Apache 1.3.x (though it's a bit unsupported now, isn't it ?),
> mod_python 3.2 for Apache 2.0.x and mod_python 3.2.x for Apache 2.2...
> It's not a big surprise, though, since we already have this issue :
>
> http://issues.apache.org/jira/browse/MODPYTHON-78
>
> Does anyone knows anything about the API changes ?

I've attached a source tree patch against 3.2.5b that will work with
apache 2.2.0. It still fails one test in the test suite, but seems to
load fine in apache and run modules in Publisher.

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

Sorry, I don't do Apache on Windows. Could someone follow up with
instructions for that platform (beyond "install Cygwin")? :)

Here are some key points:

APR_STATUS_IS_SUCCESS is gone.
apr_sockaddr_port_get is gone.
mod_auth is now mod_auth_basic.
auth_module is now auth_basic_module.

Affected files are:

  src/connobject.c
  src/filterobject.c
  test/test.py

To fix the APR_STATUS_IS_SUCCESS issue, I deleted the code that used it,
without replacement. That may be suboptimal, if the code serves a useful
purpose. :)

To fix the apr_sockaddr_port_get issue, I restored makesockaddr from
connobject.c in 3.2.1b. This was obviously replaced for a reason in
later versions, with the unfortunate choice of a deprecated function
from the API. The original issue needs to be revisited to determine a
more compatible solution.

I'm unable to diagnose the remaining failure in the test suite:

   * Testing internally (status messages go to error_log)
F
======================================================================
FAIL: test_internal (__main__.PerRequestTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test.py", line 1249, in test_internal
     self.fail("Some tests failed, see error_log")
AssertionError: Some tests failed, see error_log

----------------------------------------------------------------------
Ran 43 tests in 61.161s

FAILED (failures=1)
F  Stopping Apache...
      /usr/local/apache2.2.0/bin/httpd -k stop -f
/home/jorey/src/mod_python-3.2.5b/test/conf/test.conf

======================================================================
FAIL: testPerRequestTests (__main__.PerInstanceTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test.py", line 1805, in testPerRequestTests
     self.failUnless(result.wasSuccessful())
AssertionError

----------------------------------------------------------------------
Ran 6 tests in 107.536s

FAILED (failures=1)

The error log includes this line at the end:

logs/error_log:[Sat Dec 03 15:31:15 2005] [error] [client 127.0.0.1]
......F.\n======================================================================\nFAIL:
test_server_members
(tests.SimpleTestCase)\n----------------------------------------------------------------------\nTraceback
(most recent call last):\n  File
"/home/jorey/src/mod_python-3.2.5b/test/htdocs/tests.py", line 446, in
test_server_members\n    self.fail("server.keep_alive_timeout should be
15.0")\nAssertionError: server.keep_alive_timeout should be
15.0\n\n----------------------------------------------------------------------\nRan
8 tests in 0.336s\n\nFAILED (failures=1)\n




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



Reply via email to