xref: /netbsd-src/share/man/man3lua/bozohttpd.3lua (revision 188cf0e1a1f05f9666b50bff7ea00060c7a0c794)
1.\"     $NetBSD: bozohttpd.3lua,v 1.4 2023/03/01 21:06:41 nia Exp $
2.\"
3.\" Copyright (c) 2018 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25.\" POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd May 6, 2018
28.Dt BOZOHTTPD 3lua
29.Os
30.Sh NAME
31.Nm bozohttpd
32.Nd provides access to
33.Xr libbozohttpd 3
34functionality from Lua
35.Sh SYNOPSIS
36.Cd "local bozo = require 'bozohttpd'"
37.Pp
38.Bl -tag -width XXXX -compact
39.It Dv instance = bozo.new()
40.It Dv bozo.init_httpd(instance)
41.It Dv prefs = bozo.init_prefs()
42.It Dv bozo.set_pref(instance, prefs, name, value)
43.It Dv bozo.get_pref(prefs, name)
44.It Dv bozo.setup(instance, prefs, host, root)
45.It Dv bozo.dynamic_mime(instance, one, two, three, four)
46.It Dv bozo.ssl_set_opts(instance, one, two)
47.It Dv bozo.cgi_setbin(instance, bin)
48.It Dv bozo.cgi_map(instance, 1, 2)
49.It Dv req = bozo.read_request(instance)
50.It Dv bozo.process_request(req)
51.It Dv bozo.clean_request(req)
52.El
53.Sh DESCRIPTION
54The
55.Nm
56Lua binding provides access to functionality available in
57.Xr libbozohttpd 3 .
58.Sh EXAMPLES
59The following example code demonstrates the process of instantiating an instance
60of
61.Nm
62as a background daemon.
63The instance is set to serve files from
64.Pa /var/www
65for the hostname www.example.com on TCP port 8080.
66.Bd -literal
67local bozo = require 'bozohttpd'
68myhttpd = bozo.new()
69bozo.init_httpd(myhttpd)
70prefs = bozo.init_prefs()
71bozo.set_pref(myhttpd, prefs, "port number", "8080")
72bozo.set_pref(myhttpd, prefs, "background", 1)
73bozo.setup(myhttpd, prefs, "www.example.com", "/var/www")
74req = bozo.read_request(myhttpd)
75bozo.process_request(req)
76bozo.clean_request(req)
77.Ed
78.Sh SEE ALSO
79.Xr lua 1 ,
80.Xr luac 1 ,
81.Xr libbozohttpd 3 ,
82.Xr intro 3lua
83.Sh HISTORY
84.Nm
85Lua binding first appeared in
86.Nx 9.0 .
87.Sh AUTHORS
88.An -nosplit
89The
90.Nm
91Lua binding was written by
92.An Alistair Crooks Aq Mt agc@NetBSD.org .
93.Sh BUGS
94This manual needs more description of the available functionality.
95