LIBBOZOHTTPD(3) | Library Functions Manual | LIBBOZOHTTPD(3)

# NAME

`libbozohttpd` —
embedded web server library

# LIBRARY

library “libbozohttpd”

# SYNOPSIS

`#include <bozohttpd.h>`

int
`bozo_set_pref`(bozohttpd_t *httpd, bozoprefs_t *prefs, char *name, char *value);

char *
`bozo_get_pref`(bozoprefs_t *prefs, char *name);

int
`bozo_set_defaults`(bozohttpd_t *httpd, bozoprefs_t *prefs);

void
`bozo_setup`(bozohttpd_t *httpd, bozoprefs_t *prefs, const char *vhost, char *slash);

bozo_httpreq_t *
`bozo_read_request`(bozohttpd_t *httpd);

void
`bozo_process_request`(bozo_httpreq_t *);

void
`bozo_clean_request`(bozo_httpreq_t *);

void
`bozo_cleanup`(bozohttpd_t *httpd, bozoprefs_t *prefs);

# DESCRIPTION

`libbozohttpd` is a library interface to the bozohttpd(8) web server. The `libbozohttpd` library can be used to embed a webserver in your applications.

Normal operation sees the `libbozohttpd` process be initialised using the `bozo_set_defaults`() function, which will set up the default port and other internal settings, allocating any necessary space as needed. The `bozo_set_defaults`() function returns 1 on sucess, 0 on failure.

The `bozo_setup`() function is used to specify the virtual host name for the web server. A NULL host name will mean that `libbozohttpd` will use the local value for the host name, as returned by gethostname(3). This virtual hostname should be a fully qualified domain name. The final argument to `bozo_setup`() is the name of the directory to serve as the root directory of the web server tree.

Once the server has been set up, it serves requests by using the `bozo_read_request`() function, which returns a pointer to a request structure, and `bozo_process_request`(), which deals with the request, and answers the client. The request space is de-allocated using the `bozo_clean_request`() function.

Preferences are set using the function `bozo_set_pref`() function and queried using the two `bozo_get_pref`() function. This is the main interface for selecting options, and for setting preferences. The memory allocated by `bozo_setup`() for both the httpd structure and the preferences will be freed.

# SEE ALSO

gethostname(3), ssl(3), services(5), httpd(8)

# HISTORY

The `libbozohttpd` library first appeared in NetBSD 6.0.

# AUTHORS

Matthew R. Green <mrg@eterna.com.au>
Alistair Crooks <agc@NetBSD.org> wrote this high-level interface.

This manual page was written by
Alistair Crooks.

February 11, 2021 | NetBSD 10.1