quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@apache.org>
Subject [PATCH] Fix bug with content-type
Date Tue, 31 Dec 2002 08:38:16 GMT
I believe that patch to use ap_set_content_type (which is the right
way to do it) was broken in that it didn't maintain the strdup.
Python has a tendancy to reuse the storage for the original value, so
the content-type as sent to the user is often garbage.

This patch fixes it.  -- justin

Index: requestobject.c
===================================================================
RCS file: /home/cvspublic/httpd-python/src/requestobject.c,v
retrieving revision 1.42
diff -u -r1.42 requestobject.c
--- src/requestobject.c	30 Dec 2002 20:25:15 -0000	1.42
+++ src/requestobject.c	31 Dec 2002 08:35:29 -0000
@@ -960,7 +960,9 @@
             PyErr_SetString(PyExc_TypeError, "content_type must be a 
string");
             return -1;
         }
-        ap_set_content_type(self->request_rec, 
PyString_AsString(val));
+        ap_set_content_type(self->request_rec,
+                            apr_pstrdup(self->request_rec->pool,
+                                        PyString_AsString(val)));
         self->content_type_set = 1;
         return 0;
     }


Mime
View raw message