fielding 97/04/26 23:23:23
Modified: src CHANGES http_protocol.c buff.c
Log:
Fix problem with scripts not receiving a SIGPIPE when client drops
the connection (e.g., when user presses Stop). We now stop
trying to send a message body immediately after an error from write.
Submitted by: Roy Fielding (with help from Nathan Kurz, PR#335)
Reviewed by: Dean Gaudet, Randy Terbush, Chuck Murcko
Revision Changes Path
1.250 +5 -0 apache/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.249
retrieving revision 1.250
diff -C3 -r1.249 -r1.250
*** CHANGES 1997/04/25 00:19:37 1.249
--- CHANGES 1997/04/27 06:23:20 1.250
***************
*** 1,5 ****
--- 1,10 ----
Changes with Apache 1.2
+ *) Fix problem with scripts not receiving a SIGPIPE when client drops
+ the connection (e.g., when user presses Stop). Apache will now stop
+ trying to send a message body immediately after an error from write.
+ [Roy Fielding and Nathan Kurz] PR#335
+
*) Fix graceful restart on architectures not using scoreboard files
(it is still broken on scoreboard-file architectures).
Eliminate many signal-related race conditions in both forms of
1.117 +23 -8 apache/src/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_protocol.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -C3 -r1.116 -r1.117
*** http_protocol.c 1997/04/24 23:35:20 1.116
--- http_protocol.c 1997/04/27 06:23:21 1.117
***************
*** 1540,1553 ****
}
o=0;
total_bytes_sent += n;
!
! while(n && !r->connection->aborted) {
! w=bwrite(r->connection->client, &buf[o], n);
! if(w <= 0)
! break;
! reset_timeout(r); /* reset timeout after successful write */
! n-=w;
! o+=w;
}
}
--- 1540,1568 ----
}
o=0;
total_bytes_sent += n;
!
! while (n && !r->connection->aborted) {
! w = bwrite(r->connection->client, &buf[o], n);
! if (w > 0) {
! reset_timeout(r); /* reset timeout after successful write */
! n-=w;
! o+=w;
! }
! else if (w < 0) {
! if (r->connection->aborted)
! break;
! else if (errno == EAGAIN)
! continue;
! else {
! log_unixerr("send body lost connection to",
! get_remote_host(r->connection,
! r->per_dir_config, REMOTE_NAME),
! NULL, r->server);
! bsetflag(r->connection->client, B_EOUT, 1);
! r->connection->aborted = 1;
! break;
! }
! }
}
}
1.25 +4 -0 apache/src/buff.c
Index: buff.c
===================================================================
RCS file: /export/home/cvs/apache/src/buff.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C3 -r1.24 -r1.25
*** buff.c 1997/04/21 20:29:07 1.24
--- buff.c 1997/04/27 06:23:21 1.25
***************
*** 99,109 ****
--- 99,113 ----
static void
doerror(BUFF *fb, int err)
{
+ int errsave = errno; /* Save errno to prevent overwriting it below */
+
if (err == B_RD)
fb->flags |= B_RDERR;
else
fb->flags |= B_WRERR;
if (fb->error != NULL) (*fb->error)(fb, err, fb->error_data);
+
+ errno = errsave;
}
/* Buffering routines */