Add a manual for bozohttpd(3lua)

This commit is contained in:
sevan 2018-05-05 13:31:48 +00:00
parent 4c5f1c97df
commit b4e0088a5a
3 changed files with 110 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1583 2018/05/04 14:23:19 kamil Exp $
# $NetBSD: mi,v 1.1584 2018/05/05 13:31:48 sevan Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -661,6 +661,7 @@
./usr/share/man/cat3/i386/keycap.0 man-obsolete obsolete
./usr/share/man/cat3/libbozohttpd.0 man-sys-catman .cat
./usr/share/man/cat3/libunbound.0 man-netutil-catman .cat,unbound
./usr/share/man/cat3lua/bozohttpd.0 man-sys-catman .cat
./usr/share/man/cat3lua/gpio.0 man-sys-catman .cat
./usr/share/man/cat3lua/gpio.attach.0 man-sys-catman .cat
./usr/share/man/cat3lua/gpio.close.0 man-sys-catman .cat
@ -3847,6 +3848,7 @@
./usr/share/man/html1/znew.html man-util-htmlman html
./usr/share/man/html3/libbozohttpd.html man-sys-htmlman html
./usr/share/man/html3/libunbound.html man-netutil-htmlman html,unbound
./usr/share/man/html3lua/bozohttpd.html man-sys-htmlman html
./usr/share/man/html3lua/gpio.attach.html man-sys-htmlman html
./usr/share/man/html3lua/gpio.close.html man-sys-htmlman html
./usr/share/man/html3lua/gpio.html man-sys-htmlman html
@ -6709,6 +6711,7 @@
./usr/share/man/man3/i386/keycap.3 man-obsolete obsolete
./usr/share/man/man3/libbozohttpd.3 man-sys-man .man
./usr/share/man/man3/libunbound.3 man-netutil-man .man,unbound
./usr/share/man/man3lua/bozohttpd.3lua man-sys-man .man
./usr/share/man/man3lua/gpio.3lua man-sys-man .man
./usr/share/man/man3lua/gpio.attach.3lua man-sys-man .man
./usr/share/man/man3lua/gpio.close.3lua man-sys-man .man

View File

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.6 2018/04/30 05:23:08 htodd Exp $
# $NetBSD: Makefile,v 1.7 2018/05/05 13:31:48 sevan Exp $
MAN= gpio.3lua intro.3lua netpgp.3lua sqlite.3lua syslog.3lua
MAN= bozohttpd.3lua gpio.3lua intro.3lua netpgp.3lua sqlite.3lua syslog.3lua
MLINKS+=gpio.3lua gpio.open.3lua \
gpio.3lua gpio.info.3lua \

View File

@ -0,0 +1,104 @@
.\" $NetBSD: bozohttpd.3lua,v 1.1 2018/05/05 13:31:48 sevan Exp $
.\"
.\" Copyright (c) 2018 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Sevan Janiyan <sevan@NetBSD.org>.
.\"
.\" 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 5, 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 availabile 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
.Tn 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")
local numreps = 0
repeat
req = bozo.read_request(myhttpd)
bozo.process_request(req)
bozo.clean_request(req)
until numreps == 0
.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 .
This manual was written by
.An Sevan Janiyan Aq Mt sevan@NetBSD.org .
.Sh BUGS
This manual needs more description of the available functionality.