[mod_python] [PATCH] httpd-2.0.36

Gary Benson gbenson at redhat.com
Mon May 27 19:02:56 EST 2002


Hi all,

The attached patches to HEAD will allow you to compile and run mod_python
with httpd-2.0.36. There are still a bunch of compiler warnings which I
haven't fixed (but intend to), but it seems to run quite nicely (although
my minimal mod_python knowledge probably isn't stressing it much).

Cheers,
Gary

[ gbenson at redhat.com ][ GnuPG 85A8F78B ][ http://inauspicious.org/ ]
-------------- next part --------------
An allocator-passing mechanism was added throughout the bucket brigades API

Index: src/filterobject.c
===================================================================
RCS file: /cvsroot/modpython/mod_python/src/filterobject.c,v
retrieving revision 1.4
diff -u -r1.4 filterobject.c
--- src/filterobject.c	4 Mar 2002 21:19:17 -0000	1.4
+++ src/filterobject.c	27 May 2002 11:18:30 -0000
@@ -115,6 +115,7 @@
 static PyObject *_filter_read(filterobject *self, PyObject *args, int readline)
 {
 
+    conn_rec *c = self->request_obj->request_rec->connection;
     apr_bucket *b;
     long bytes_read;
     PyObject *result;
@@ -135,7 +136,8 @@
 
 	/* does the output brigade exist? */
 	if (!self->bb_in) {
-	    self->bb_in = apr_brigade_create(self->f->r->pool);
+	    self->bb_in = apr_brigade_create(self->f->r->pool,
+					     c->bucket_alloc);
 	}
 
 	Py_BEGIN_ALLOW_THREADS;
@@ -290,6 +292,7 @@
 static PyObject *filter_write(filterobject *self, PyObject *args)
 {
 
+    conn_rec *c = self->request_obj->request_rec->connection;
     char *buff;
     int len;
     apr_bucket *b;
@@ -315,10 +318,12 @@
 
 	/* does the output brigade exist? */
 	if (!self->bb_out) {
-	    self->bb_out = apr_brigade_create(self->f->r->pool);
+	    self->bb_out = apr_brigade_create(self->f->r->pool,
+					      c->bucket_alloc);
 	}
 	
-	b = apr_bucket_pool_create(buff, len, self->f->r->pool);
+	b = apr_bucket_pool_create(buff, len, self->f->r->pool,
+				   c->bucket_alloc);
 	APR_BRIGADE_INSERT_TAIL(self->bb_out, b);
 	
 	self->bytes_written += len;
@@ -337,12 +342,15 @@
 static PyObject *filter_flush(filterobject *self, PyObject *args)
 {
 
+    conn_rec *c = self->request_obj->request_rec->connection;
+
     /* does the output brigade exist? */
     if (!self->bb_out) {
-	self->bb_out = apr_brigade_create(self->f->r->pool);
+	self->bb_out = apr_brigade_create(self->f->r->pool, c->bucket_alloc);
     }
 
-    APR_BRIGADE_INSERT_TAIL(self->bb_out, apr_bucket_flush_create());
+    APR_BRIGADE_INSERT_TAIL(self->bb_out,
+			    apr_bucket_flush_create(c->bucket_alloc));
 
     if (ap_pass_brigade(self->f->next, self->bb_out) != APR_SUCCESS) {
 	PyErr_SetString(PyExc_IOError, "Flush failed.");
@@ -363,16 +371,20 @@
 static PyObject *filter_close(filterobject *self, PyObject *args)
 {
 
+    conn_rec *c = self->request_obj->request_rec->connection;
+
     if (! self->closed) {
 
 	if (self->bytes_written) {
 
 	    /* does the output brigade exist? */
 	    if (!self->bb_out) {
-		self->bb_out = apr_brigade_create(self->f->r->pool);
+		self->bb_out = apr_brigade_create(self->f->r->pool,
+						  c->bucket_alloc);
 	    }
 
-	    APR_BRIGADE_INSERT_TAIL(self->bb_out, apr_bucket_eos_create());
+	    APR_BRIGADE_INSERT_TAIL(self->bb_out,
+				    apr_bucket_eos_create(c->bucket_alloc));
 	
 	    if (! self->is_input) {
 		ap_pass_brigade(self->f->next, self->bb_out);
-------------- next part --------------
Various AP_FTYPE_* constants were changed in 2.0.34

Index: src/mod_python.c
===================================================================
RCS file: /cvsroot/modpython/mod_python/src/mod_python.c,v
retrieving revision 1.59
diff -u -r1.59 mod_python.c
--- src/mod_python.c	5 Mar 2002 01:43:39 -0000	1.59
+++ src/mod_python.c	27 May 2002 10:50:15 -0000
@@ -1467,7 +1467,7 @@
     /* register the filter NOTE - this only works so long as the
        directive is only allowed in the main config. For .htaccess we
        would have to make sure not to duplicate this */
-    ap_register_input_filter(name, python_input_filter, AP_FTYPE_CONTENT);
+    ap_register_input_filter(name, python_input_filter, AP_FTYPE_RESOURCE);
  
     return NULL;
 }
@@ -1491,7 +1491,7 @@
     /* register the filter NOTE - this only works so long as the
        directive is only allowed in the main config. For .htaccess we
        would have to make sure not to duplicate this */
-    ap_register_output_filter(name, python_output_filter, AP_FTYPE_CONTENT);
+    ap_register_output_filter(name, python_output_filter, AP_FTYPE_RESOURCE);
  
     return NULL;
 }
-------------- next part --------------
ap_restart_time was moved into the scoreboard global area.

Index: src/serverobject.c
===================================================================
RCS file: /cvsroot/modpython/mod_python/src/serverobject.c,v
retrieving revision 1.8
diff -u -r1.8 serverobject.c
--- src/serverobject.c	9 Sep 2001 00:25:37 -0000	1.8
+++ src/serverobject.c	27 May 2002 10:59:54 -0000
@@ -241,7 +241,7 @@
 	return PyInt_FromLong((long)ap_my_generation);
     }
     else if (strcmp(name, "restart_time") == 0) {
-	return PyInt_FromLong((long)ap_restart_time);
+	return PyInt_FromLong((long)ap_scoreboard_image->global->restart_time);
     }
     else
 	return PyMember_Get((char *)self->server, server_memberlist, name);


More information about the Mod_python mailing list