3 .\" Copyright (c) 2000 Alfred Perlstein
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .\" $FreeBSD: src/share/man/man9/accf_http.9,v 1.11 2005/01/18 20:52:51 ru Exp $
34 .Nd "buffer incoming connections until a certain complete HTTP requests arrive"
37 .Cd "pseudo-device accf_http"
39 This is a filter to be placed on a socket that will be using
41 to receive incoming HTTP connections.
43 Once installed on a listening socket, this filter is activated when a
44 connection becomes ready to receive data (at which point
46 would usually return the connected descriptor to the application).
47 The filter prevents the descriptor from being returned immediately
48 to the application via
50 The descriptor is made available to the application via
52 only when one of the following conditions is met:
55 A complete, syntactically valid HTTP/1.0 or HTTP/1.1 HEAD or GET request has
56 been buffered by the kernel.
58 The data buffered by the kernel cannot be part of a complete, syntactically
59 valid HTTP 1.0 or HTTP/1.1 HEAD or GET request.
64 is that a server will not have to context switch several times
65 before performing the initial parsing of the request.
66 This effectively reduces the amount of required CPU utilization
67 to handle incoming requests by keeping active
68 processes in preforking servers such as Apache low
69 and reducing the size of the file descriptor set that needs
70 to be managed by interfaces such as
77 If the accf_data accept filter is present in the kernel configuration,
78 this will enable the http accept filter
81 .Bd -literal -offset 0i
82 struct accept_filter_arg afa;
84 bzero(\*[Am]afa, sizeof(afa));
85 strcpy(afa.af_name, "httpready");
86 setsockopt(sok, SOL_SOCKET, SO_ACCEPTFILTER, \*[Am]afa, sizeof(afa));
92 The accept filter mechanism and the
93 accf_http filter were introduced in
97 by Coyote Point Systems and appeared in
100 This manual page and the filter were written by
101 .An Alfred Perlstein .