summaryrefslogtreecommitdiff
path: root/libexec/httpd/libbozohttpd
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2010-05-10 03:30:04 +0000
committermrg <mrg@NetBSD.org>2010-05-10 03:30:04 +0000
commit390458fa546a7c8cf4c2ef38e584c9bbbc2cd638 (patch)
tree3938648e1845c1cba939af177317c91561ef9ee4 /libexec/httpd/libbozohttpd
parent10e151e52e2a8ed4f8f81ec5c34250e73569797b (diff)
import bozohttpd 20100509. it has these changes:
o major rework and clean up of internal interfaces. move the main program into main.c, the remaining parts are useable as library. add bindings for lua. by Alistair G. Crooks <agc@netbsd.org> o fix http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=566325 special thanks to al for the majority of these changes.
Diffstat (limited to 'libexec/httpd/libbozohttpd')
-rw-r--r--libexec/httpd/libbozohttpd/Makefile36
-rw-r--r--libexec/httpd/libbozohttpd/libbozohttpd.3143
-rw-r--r--libexec/httpd/libbozohttpd/shlib_version2
3 files changed, 181 insertions, 0 deletions
diff --git a/libexec/httpd/libbozohttpd/Makefile b/libexec/httpd/libbozohttpd/Makefile
new file mode 100644
index 00000000000..52945a61e55
--- /dev/null
+++ b/libexec/httpd/libbozohttpd/Makefile
@@ -0,0 +1,36 @@
+# $eterna: Makefile,v 1.1 2010/05/10 02:24:31 mrg Exp $
+
+.PATH: $(.CURDIR)/..
+
+# build bozohttpd library
+LIB= bozohttpd
+COPTS+= -I$(.CURDIR)/..
+
+COPTS+= -DDO_HTPASSWD
+CPPFLAGS+= -DDO_HTPASSWD
+SRCS= bozohttpd.c ssl-bozo.c auth-bozo.c cgi-bozo.c daemon-bozo.c
+SRCS+= tilde-luzah-bozo.c dir-index-bozo.c content-bozo.c
+
+LDADD= -lcrypt
+DPADD= ${LIBCRYPT}
+
+MAN= libbozohttpd.3
+WARNS= 4
+
+INCS= bozohttpd.h
+INCSDIR= /usr/include
+
+.include <bsd.own.mk>
+
+.if ${MKCRYPTO} != "no"
+
+LDADD+= -lssl -lcrypto
+DPADD+= ${LIBSSL} ${LIBCRYPTO}
+
+.else
+
+COPTS+= -DNO_SSL_SUPPORT
+
+.endif
+
+.include <bsd.lib.mk>
diff --git a/libexec/httpd/libbozohttpd/libbozohttpd.3 b/libexec/httpd/libbozohttpd/libbozohttpd.3
new file mode 100644
index 00000000000..6da03ecc328
--- /dev/null
+++ b/libexec/httpd/libbozohttpd/libbozohttpd.3
@@ -0,0 +1,143 @@
+.\" $NetBSD: libbozohttpd.3,v 1.1.1.1 2010/05/10 03:30:04 mrg Exp $
+.\"
+.\" $eterna: libbozohttpd.3,v 1.2 2010/05/10 02:48:23 mrg Exp $
+.\"
+.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This manual page is derived from software contributed to The
+.\" NetBSD Foundation by Alistair Crooks (agc@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 November 5, 2009
+.Dt LIBBOZOHTTPD 3
+.Os
+.Sh NAME
+.Nm libbozohttpd
+.Nd embedded web server library
+.Sh LIBRARY
+.Lb libbozohttpd
+.Sh SYNOPSIS
+.In bozohttpd.h
+.Ft int
+.Fo bozo_set_pref
+.Fa "bozoprefs_t *prefs" "char *name" "char *value"
+.Fc
+.Ft char *
+.Fo bozo_get_pref
+.Fa "bozoprefs_t *prefs" "char *name"
+.Fc
+.Ft int
+.Fo bozo_set_defaults
+.Fa "bozohttpd_t *httpd" "bozoprefs_t *prefs"
+.Fc
+.Ft void
+.Fo bozo_setup
+.Fa "bozohttpd_t *httpd" "bozoprefs_t *prefs" "const char *vhost" "char *slash"
+.Fc
+.Ft bozo_httpreq_t *
+.Fo bozo_read_request
+.Fa "bozohttpd_t *httpd"
+.Fc
+.Ft void
+.Fo bozo_process_request
+.Fa "bozo_httpreq_t *"
+.Fc
+.Ft void
+.Fo bozo_clean_request
+.Fa "bozo_httpreq_t *"
+.Fc
+.Sh DESCRIPTION
+.Nm
+is a library interface to the
+.Xr bozohttpd 8
+web server.
+The
+.Nm
+library can be used to embed a webserver
+in your applications.
+.Pp
+Normal operation sees the
+.Nm
+process be initialised using the
+.Fn bozo_set_defaults
+function, which will set up the default port
+and other internal settings, allocating
+any necessary space as needed.
+The
+.Fn bozo_set_defaults
+function returns 1 on sucess, 0 on failure.
+.Pp
+The
+.Fn bozo_setup
+function is used to specify the virtual host name
+for the web server.
+A NULL host name will mean that
+.Nm
+will use the local value for the host name,
+as returned by
+.Xr gethostname 3 .
+This virtual hostname should be a fully qualified domain name.
+The final argument to
+.Fn bozo_setup
+is the name of the directory to serve as the root
+directory of the web server tree.
+.Pp
+Once the server has been set up, it serves
+requests by using the
+.Fn bozo_read_request
+function, which returns a pointer to a request structure,
+and
+.Fn bozo_process_request ,
+which deals with the request, and answers the client.
+The request space is de-allocated
+using the
+.Fn bozo_clean_request
+function.
+.Pp
+Preferences are set
+using the function
+.Fn bozo_set_pref
+function
+and queried using the two
+.Fn bozo_get_pref
+function.
+This is the main interface for selecting options, and for
+setting preferences.
+.Sh SEE ALSO
+.Xr gethostname 3 ,
+.Xr ssl 3 ,
+.Xr services 5 ,
+.Xr httpd 8
+.Sh HISTORY
+The
+.Nm
+library first appeared in
+.Nx 6.0 .
+.Sh AUTHORS
+.An Matthew R. Green Aq mrg@eterna.com.au
+.An Alistair Crooks Aq agc@NetBSD.org
+wrote this high-level interface.
+.Pp
+This manual page was written by
+.An Alistair Crooks .
diff --git a/libexec/httpd/libbozohttpd/shlib_version b/libexec/httpd/libbozohttpd/shlib_version
new file mode 100644
index 00000000000..97c9f92d6b8
--- /dev/null
+++ b/libexec/httpd/libbozohttpd/shlib_version
@@ -0,0 +1,2 @@
+major=0
+minor=0