diff --git a/Doc/appendixc.tex b/Doc/appendixc.tex index d1f93828..577dcedc 100644 --- a/Doc/appendixc.tex +++ b/Doc/appendixc.tex @@ -349,6 +349,11 @@ \chapter{Changes from Version (3.2.x)\label{app-changes-from-3.2.x}} (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-179]{MODPYTHON-179}) Fixed the behaviour of req.readlines() when a size hint was provided. Previously, it would always return a single line when a size hint was provided. + \item + (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-180]{MODPYTHON-180}) + Publisher would wrongly output a warning about nothing to publish if + \code{req.write()} or \code{req.sendfile()} used and data not flushed, + and then published function returned \code{None}. \item (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-181]{MODPYTHON-181}) Fixed memory leak when mod_python handlers are defined for more than diff --git a/lib/python/mod_python/__init__.py b/lib/python/mod_python/__init__.py index 71c8b1ce..ba27ed98 100644 --- a/lib/python/mod_python/__init__.py +++ b/lib/python/mod_python/__init__.py @@ -20,5 +20,5 @@ __all__ = ["apache", "cgihandler", "psp", "publisher", "util", "python22"] -version = "3.3.0-dev-20060827" +version = "3.3.0-dev-20061008" diff --git a/lib/python/mod_python/publisher.py b/lib/python/mod_python/publisher.py index 4ccef1f1..009a7ba4 100644 --- a/lib/python/mod_python/publisher.py +++ b/lib/python/mod_python/publisher.py @@ -213,7 +213,7 @@ def handler(req): published = publish_object(req, object) # we log a message if nothing was published, it helps with debugging - if (not published) and (req.bytes_sent==0) and (req.next is None): + if (not published) and (req._bytes_queued==0) and (req.next is None): log=int(req.get_config().get("PythonDebug", 0)) if log: req.log_error("mod_python.publisher: nothing to publish.") diff --git a/src/include/mpversion.h b/src/include/mpversion.h index 12306ad2..345ca6ee 100644 --- a/src/include/mpversion.h +++ b/src/include/mpversion.h @@ -1,5 +1,5 @@ #define MPV_MAJOR 3 #define MPV_MINOR 3 #define MPV_PATCH 0 -#define MPV_BUILD 20061002 -#define MPV_STRING "3.3.0-dev-20061002" +#define MPV_BUILD 20061008 +#define MPV_STRING "3.3.0-dev-20061008" diff --git a/src/include/requestobject.h b/src/include/requestobject.h index 4539482a..9e1f4f18 100644 --- a/src/include/requestobject.h +++ b/src/include/requestobject.h @@ -42,6 +42,7 @@ extern "C" { PyObject * phase; char * extension; /* for | .ext syntax */ int content_type_set; + apr_off_t bytes_queued; hlistobject * hlo; PyObject * callbacks; char * rbuff; /* read bufer */ diff --git a/src/requestobject.c b/src/requestobject.c index f999699b..ba784262 100644 --- a/src/requestobject.c +++ b/src/requestobject.c @@ -67,6 +67,7 @@ PyObject * MpRequest_FromRequest(request_rec *req) result->phase = NULL; result->extension = NULL; result->content_type_set = 0; + result->bytes_queued = 0; result->hlo = NULL; result->callbacks = PyList_New(0); if (!result->callbacks) @@ -1462,6 +1463,8 @@ static PyObject * req_write(requestobject *self, PyObject *args) } } + self->bytes_queued += len; + Py_INCREF(Py_None); return Py_None; @@ -1538,6 +1541,8 @@ static PyObject * req_sendfile(requestobject *self, PyObject *args) return NULL; } + self->bytes_queued += len; + py_result = PyLong_FromLong (nbytes); Py_INCREF(py_result); return py_result; @@ -1692,6 +1697,17 @@ static PyObject *getreq_recmbr(requestobject *self, void *name) Py_INCREF(self->notes); return self->notes; } + else if (strcmp(name, "_bytes_queued") == 0) { + if (sizeof(apr_off_t) == sizeof(LONG_LONG)) { + LONG_LONG l = self->bytes_queued; + return PyLong_FromLongLong(l); + } + else { + /* assume it's long */ + long l = self->bytes_queued; + return PyLong_FromLong(l); + } + } else return PyMember_GetOne((char*)self->request_rec, find_memberdef(request_rec_mbrs, name)); @@ -2006,6 +2022,7 @@ static PyGetSetDef request_getsets[] = { /* XXX htaccess */ /* XXX filters and eos */ {"eos_sent", (getter)getreq_recmbr, NULL, "EOS bucket sent", "eos_sent"}, + {"_bytes_queued", (getter)getreq_recmbr, NULL, "Bytes queued by handler", "_bytes_queued"}, {NULL} /* Sentinel */ };