.\" $NetBSD: bozohttpd.3lua,v 1.4 2023/03/01 21:06:41 nia Exp $ .\" .\" Copyright (c) 2018 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd May 6, 2018 .Dt BOZOHTTPD 3lua .Os .Sh NAME .Nm bozohttpd .Nd provides access to .Xr libbozohttpd 3 functionality from Lua .Sh SYNOPSIS .Cd "local bozo = require 'bozohttpd'" .Pp .Bl -tag -width XXXX -compact .It Dv instance = bozo.new() .It Dv bozo.init_httpd(instance) .It Dv prefs = bozo.init_prefs() .It Dv bozo.set_pref(instance, prefs, name, value) .It Dv bozo.get_pref(prefs, name) .It Dv bozo.setup(instance, prefs, host, root) .It Dv bozo.dynamic_mime(instance, one, two, three, four) .It Dv bozo.ssl_set_opts(instance, one, two) .It Dv bozo.cgi_setbin(instance, bin) .It Dv bozo.cgi_map(instance, 1, 2) .It Dv req = bozo.read_request(instance) .It Dv bozo.process_request(req) .It Dv bozo.clean_request(req) .El .Sh DESCRIPTION The .Nm Lua binding provides access to functionality available in .Xr libbozohttpd 3 . .Sh EXAMPLES The following example code demonstrates the process of instantiating an instance of .Nm as a background daemon. The instance is set to serve files from .Pa /var/www for the hostname www.example.com on TCP port 8080. .Bd -literal local bozo = require 'bozohttpd' myhttpd = bozo.new() bozo.init_httpd(myhttpd) prefs = bozo.init_prefs() bozo.set_pref(myhttpd, prefs, "port number", "8080") bozo.set_pref(myhttpd, prefs, "background", 1) bozo.setup(myhttpd, prefs, "www.example.com", "/var/www") req = bozo.read_request(myhttpd) bozo.process_request(req) bozo.clean_request(req) .Ed .Sh SEE ALSO .Xr lua 1 , .Xr luac 1 , .Xr libbozohttpd 3 , .Xr intro 3lua .Sh HISTORY .Nm Lua binding first appeared in .Nx 9.0 . .Sh AUTHORS .An -nosplit The .Nm Lua binding was written by .An Alistair Crooks Aq Mt agc@NetBSD.org . .Sh BUGS This manual needs more description of the available functionality.