#
-# $Id: cf.data.pre,v 1.471 2007/09/19 21:42:16 hno Exp $
+# $Id: cf.data.pre,v 1.472 2007/09/21 15:16:42 hno Exp $
#
# SQUID Web Proxy Cache http://www.squid-cache.org/
# ----------------------------------------------------------
DOC_END
NAME: accept_filter
-IFDEF: SO_ACCEPTFILTER
TYPE: string
DEFAULT: none
LOC: Config.accept_filter
DOC_START
+ FreeBSD:
+
The name of an accept(2) filter to install on Squid's
listen socket(s). This feature is perhaps specific to
FreeBSD and requires support in the kernel.
The 'httpready' filter delays delivering new connections
to Squid until a full HTTP request has been received.
- See the accf_http(9) man page.
-
+ See the accf_http(9) man page for details.
+
+ The 'dataready' filter delays delivering new connections
+ to Squid until there is some data to process.
+ See the accf_dataready(9) man page for details.
+
+ Linux:
+
+ The 'data' filter delays delivering of new connections
+ to Squid until there is some data to process by TCP_ACCEPT_DEFER.
+ You may optionally specify a number of seconds to wait by
+ 'data=N' where N is the number of seconds. Defaults to 30
+ if not specified. See the tcp(7) man page for details.
EXAMPLE:
+# FreeBSD
accept_filter httpready
+# Linux
+accept_filter data
DOC_END
NAME: tcp_recv_bufsize
/*
- * $Id: comm.cc,v 1.435 2007/08/24 17:56:45 hno Exp $
+ * $Id: comm.cc,v 1.436 2007/09/21 15:16:42 hno Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
return x;
}
+ if (Config.accept_filter && strcmp(Config.accept_filter, "none") != 0) {
#ifdef SO_ACCEPTFILTER
- if (Config.accept_filter) {
struct accept_filter_arg afa;
bzero(&afa, sizeof(afa));
debug(5, 0) ("Installing accept filter '%s' on FD %d\n",
xstrncpy(afa.af_name, Config.accept_filter, sizeof(afa.af_name));
x = setsockopt(sock, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
if (x < 0)
- debug(5, 0) ("SO_ACCEPTFILTER '%s': %s\n", Config.accept_filter, xstrerror());
- }
+ debugs(5, 0, "SO_ACCEPTFILTER '" << Config.accept_filter << "': '" << xstrerror());
+#elif defined(TCP_DEFER_ACCEPT)
+ int seconds = 30;
+ if (strncmp(Config.accept_filter, "data=", 5) == 0)
+ seconds = atoi(Config.accept_filter + 5);
+ x = setsockopt(sock, IPPROTO_TCP, TCP_DEFER_ACCEPT, &seconds, sizeof(seconds));
+ if (x < 0)
+ debugs(5, 0, "TCP_DEFER_ACCEPT '" << Config.accept_filter << "': '" << xstrerror());
+#else
+ debugs(5, 0, "accept_filter not supported on your OS");
#endif
+ }
return sock;
}