You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2003/02/07 01:07:42 UTC
cvs commit: modperl-2.0/src/modules/perl modperl_filter.c
stas 2003/02/06 16:07:42
Modified: src/modules/perl modperl_filter.c
Log:
solve a nasty bug happening in certain situations when the current script
dies and sends no body, but wb->outbuf has some persistant data from the
previous request so an empty brigade is sent causing inconsistent response
codes. a more detailed explanation is in the comment.
Revision Changes Path
1.49 +17 -3 modperl-2.0/src/modules/perl/modperl_filter.c
Index: modperl_filter.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- modperl_filter.c 25 Jan 2003 03:08:04 -0000 1.48
+++ modperl_filter.c 7 Feb 2003 00:07:42 -0000 1.49
@@ -26,14 +26,28 @@
/* XXX: bodytext == NULL here */
return status;
}
- else if (!bodytext) {
+
+ if (!bodytext) {
return APR_SUCCESS;
}
-
- if (bodytext) {
+ else {
len -= (bodytext - buf);
buf = bodytext;
+ /*
+ * since wb->outbuf is persistent between requests, if the
+ * current response is shorter than the size of wb->outbuf
+ * it may include data from the previous request at the
+ * end. When this function receives a pointer to
+ * wb->outbuf as 'buf', modperl_cgi_header_parse may
+ * return that irrelevant data as part of 'bodytext'. So
+ * to avoid this risk, we check whether there is any real
+ * data to send and if not return.
+ */
+ if (!len) {
+ return APR_SUCCESS;
+ }
}
+
}
bb = apr_brigade_create(wb->pool, ba);