ACCF_HTTP(9)
π ACCF_HTTP π
okay bestie, this is the ACCF_HTTP page from section 9 of the Kernel Developer's Manual β yes, the kernel dev one, we're going deep today π«Ά
β¨ NAME β¨
accf_http β buffer incoming connections until a certain complete HTTP requests arrive
like, it just holds the vibe at the door until the whole request shows up. no half-sent requests walking in here πͺπ
π¦ SYNOPSIS π¦
options INET
options ACCEPT_FILTER_HTTP
kldload accf_http
that's it, that's the whole entrance fee β¨
πΈ DESCRIPTION πΈ
So. This is a filter you place on a socket that's gonna be using accept() to receive incoming HTTP connections. It's giving bouncer-at-the-club energy π§
It prevents the application from receiving the connected descriptor via accept() until either a full HTTP/1.0 or HTTP/1.1 HEAD or GET request has been buffered by the kernel. Like, the app literally cannot get that file descriptor until the request is complete. Periodt. π
But if something other than an HTTP/1.0 or HTTP/1.1 HEAD or GET request shows up? The kernel's like "aight, not my problem," and lets the application receive the connection descriptor via accept() anyway. Not it gatekeeping things it doesn't understand π
The whole point of accf_http β the utility, the reason it ate and left no crumbs β is that a server won't have to context switch several times before doing the initial parsing of the request. Which effectively reduces the amount of required CPU utilization to handle incoming requests by:
- keeping active processes in preforking servers such as Apache low, and
- reducing the size of the file descriptor set that needs to be managed by interfaces such as
select(),poll()orkevent()based servers.
iconic behaviour, fr fr π
Also!! The accf_http kernel option is also a module that can be enabled at runtime via kldload(8) β but only if the INET option has been compiled into the kernel. so like, INET is the prerequisite bestie, no skipping steps π
π EXAMPLES π
Assuming ACCEPT_FILTER_HTTP has been included in the kernel config file, or the accf_http module has been loaded β either way works β this will enable the http accept filter on the socket sok:
struct accept_filter_arg afa;
bzero(&afa, sizeof(afa));
strcpy(afa.af_name, "httpready");
setsockopt(sok, SOL_SOCKET, SO_ACCEPTFILTER, &afa, sizeof(afa));
look at that. "httpready" β the name literally tells you the vibe. slay β¨
π₯ SEE ALSO π₯
go read those too, iykyk π
π HISTORY π
The accept filter mechanism and the accf_http filter were introduced in FreeBSD 4.0. so they've been serving looks since forever π
π AUTHORS π
This manual page and the filter were written by Alfred Perlstein. thank you king π«Ά
Debian Β· November 15, 2000 β that's the version and the date bestie, mwah, catch u on the next page ππ β¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2000 Alfred Perlstein
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms