Index: src/client_side.c =================================================================== RCS file: /squid/squid/src/client_side.c,v retrieving revision 1.512.2.10 diff -w -u -r1.512.2.10 client_side.c --- src/client_side.c 2001/04/20 23:21:41 1.512.2.10 +++ src/client_side.c 2001/08/12 02:13:22 @@ -1705,6 +1705,9 @@ debug(33, 1) ("clientSendMoreData: Deferring %s\n", storeUrl(entry)); memFree(buf, MEM_CLIENT_SOCK_BUF); return; + } else if (http->request->flags.reset_tcp) { + comm_reset_close(fd); + return; } else if (entry && EBIT_TEST(entry->flags, ENTRY_ABORTED)) { /* call clientWriteComplete so the client socket gets closed */ clientWriteComplete(fd, NULL, 0, COMM_OK, http); Index: src/comm.c =================================================================== RCS file: /squid/squid/src/comm.c,v retrieving revision 1.312.2.2 diff -w -u -r1.312.2.2 comm.c --- src/comm.c 2001/02/23 19:43:15 1.312.2.2 +++ src/comm.c 2001/08/12 02:13:33 @@ -573,6 +573,21 @@ } #endif +/* + * enable linger with time of 0 so that when the socket is + * closed, TCP generates a RESET + */ +void +comm_reset_close(int fd) +{ + struct linger L; + L.l_onoff = 1; + L.l_linger = 0; + if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &L, sizeof(L)) < 0) + debug(50, 0) ("commResetTCPClose: FD %d: %s\n", fd, xstrerror()); + comm_close(fd); +} + void comm_close(int fd) { Index: src/errorpage.c =================================================================== RCS file: /squid/squid/src/errorpage.c,v retrieving revision 1.156.2.3 diff -w -u -r1.156.2.3 errorpage.c --- src/errorpage.c 2001/01/12 00:51:47 1.156.2.3 +++ src/errorpage.c 2001/08/12 02:13:46 @@ -275,6 +275,12 @@ errorStateFree(err); return; } + if (0 == strncmp(error_text[err->page_id], "reset", 5)) { + if (err->request) { + debug(0,0)("RSTing this reply\n"); + err->request->flags.reset_tcp = 1; + } + } storeLockObject(entry); storeBuffer(entry); rep = errorBuildReply(err); Index: src/protos.h =================================================================== RCS file: /squid/squid/src/protos.h,v retrieving revision 1.387.2.6 diff -w -u -r1.387.2.6 protos.h --- src/protos.h 2001/05/20 00:09:59 1.387.2.6 +++ src/protos.h 2001/08/12 02:14:07 @@ -123,6 +123,7 @@ extern void commSetCloseOnExec(int fd); extern int comm_accept(int fd, struct sockaddr_in *, struct sockaddr_in *); extern void comm_close(int fd); +extern void comm_reset_close(int fd); #if LINGERING_CLOSE extern void comm_lingering_close(int fd); #endif Index: src/structs.h =================================================================== RCS file: /squid/squid/src/structs.h,v retrieving revision 1.361.2.14 diff -w -u -r1.361.2.14 structs.h --- src/structs.h 2001/04/04 07:01:12 1.361.2.14 +++ src/structs.h 2001/08/12 02:14:18 @@ -1408,6 +1408,7 @@ #endif unsigned int accelerated:1; unsigned int internal:1; + unsigned int reset_tcp:1; }; struct _link_list {