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