dgaudet 98/07/01 11:18:27
Modified: src CHANGES
src/main buff.c
Log:
It's definately wrong to start ap_bprintf() on a connection that's got an
error, or one which is not buffered.
It's wrong for ap_bflush() to return 0 when B_EOUT is set -- B_EOUT can
be set by timeout(), and it seems pointless for code everywhere to have
to test for B_EOUT when they can simply test for a ap_bflush() failure.
Revision Changes Path
1.943 +4 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.942
retrieving revision 1.943
diff -u -r1.942 -r1.943
--- CHANGES 1998/07/01 01:37:27 1.942
+++ CHANGES 1998/07/01 18:18:23 1.943
@@ -1,5 +1,9 @@
Changes with Apache 1.3.1
+ *) The ap_bprintf() code neglected to test if there was an error on
+ the connection. ap_bflush() misdiagnosed a failure as a success.
+ [Dean Gaudet]
+
*) add support for #perl arg interpolation in mod_include
[Doug MacEachern]
1.78 +8 -1 apache-1.3/src/main/buff.c
Index: buff.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- buff.c 1998/06/04 19:58:57 1.77
+++ buff.c 1998/07/01 18:18:25 1.78
@@ -1193,6 +1193,7 @@
static char *cbuf = NULL;
static int csize = 0;
+ /* XXX: martin don't you want to do this after the error tests below? */
if (bgetflag(fb, B_EBCDIC2ASCII)) {
if (nbyte > csize) {
if (cbuf != NULL)
@@ -1362,7 +1363,7 @@
int ret;
if (!(fb->flags & B_WR) || (fb->flags & B_EOUT))
- return 0;
+ return -1;
if (fb->flags & B_WRERR)
return -1;
@@ -1523,6 +1524,9 @@
int res;
struct bprintf_data b;
+ /* XXX: only works with buffered writes */
+ if ((fb->flags & (B_WRERR | B_EOUT | B_WR)) != B_WR)
+ return -1;
b.vbuff.curpos = (char *)&fb->outbase[fb->outcnt];
b.vbuff.endpos = (char *)&fb->outbase[fb->bufsiz];
b.fb = fb;
@@ -1547,6 +1551,9 @@
struct bprintf_data b;
int res;
+ /* XXX: only works with buffered writes */
+ if ((fb->flags & (B_WRERR | B_EOUT | B_WR)) != B_WR)
+ return -1;
b.vbuff.curpos = (char *)&fb->outbase[fb->outcnt];
b.vbuff.endpos = (char *)&fb->outbase[fb->bufsiz];
b.fb = fb;