to make Squid send TCP resets for certain error pages.
/*
- * $Id: client_side.cc,v 1.566 2002/04/01 05:59:50 wessels Exp $
+ * $Id: client_side.cc,v 1.567 2002/04/01 06:02:15 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
/* there is another object in progress, defer this one */
debug(33, 2) ("clientSendMoreData: Deferring %s\n", storeUrl(entry));
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);
/*
- * $Id: comm.cc,v 1.327 2002/04/01 05:59:50 wessels Exp $
+ * $Id: comm.cc,v 1.328 2002/04/01 06:02:15 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
}
#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)
{
/*
- * $Id: errorpage.cc,v 1.168 2002/01/01 21:24:25 hno Exp $
+ * $Id: errorpage.cc,v 1.169 2002/04/01 06:02:15 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
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);
/*
- * $Id: protos.h,v 1.429 2002/04/01 05:59:50 wessels Exp $
+ * $Id: protos.h,v 1.430 2002/04/01 06:02:16 wessels Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
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
/*
- * $Id: structs.h,v 1.411 2002/04/01 05:59:50 wessels Exp $
+ * $Id: structs.h,v 1.412 2002/04/01 06:02:16 wessels Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
unsigned int accelerated:1;
unsigned int internal:1;
unsigned int body_sent:1;
+ unsigned int reset_tcp:1;
};
struct _link_list {