aboutsummaryrefslogtreecommitdiff
path: root/doc/man7
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-10 23:21:35 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-11 00:07:13 +0200
commit0222b75e8554796548e079aa3393c512ae30ac24 (patch)
tree5a154258ae5c1434a211ee67537e46ef64058437 /doc/man7
parent832e198f8c77970b5b923eb18201ba83d9c72b80 (diff)
downloadlibweb-0.1.0-rc3.tar.gz
Rename project from slweb to libwebv0.1.0-rc3
It was found out there was another project of the same name around (https://git.sr.ht/~strahinja/slweb/), also related to website generation. In order to avoid confusion, a new name has been chosen for this project. Surprisingly, libweb was not in use by any distributions (according to https://repology.org and AUR index), and it should reflect well the intention behind this project i.e., being a library to build web-related stuff.
Diffstat (limited to 'doc/man7')
-rw-r--r--doc/man7/Makefile6
-rw-r--r--doc/man7/libweb_handler.7 (renamed from doc/man7/slweb_handler.7)30
-rw-r--r--doc/man7/libweb_html.7 (renamed from doc/man7/slweb_html.7)18
-rw-r--r--doc/man7/libweb_http.7 (renamed from doc/man7/slweb_http.7)52
4 files changed, 53 insertions, 53 deletions
diff --git a/doc/man7/Makefile b/doc/man7/Makefile
index 4945d1f..c4e1ca7 100644
--- a/doc/man7/Makefile
+++ b/doc/man7/Makefile
@@ -3,9 +3,9 @@
PREFIX = /usr/local
DST = $(PREFIX)/share/man/man7
OBJECTS = \
- $(DST)/slweb_handler.7 \
- $(DST)/slweb_html.7 \
- $(DST)/slweb_http.7
+ $(DST)/libweb_handler.7 \
+ $(DST)/libweb_html.7 \
+ $(DST)/libweb_http.7
all:
diff --git a/doc/man7/slweb_handler.7 b/doc/man7/libweb_handler.7
index 53fb156..5c910e0 100644
--- a/doc/man7/slweb_handler.7
+++ b/doc/man7/libweb_handler.7
@@ -1,36 +1,36 @@
-.TH SLWEB_HANDLER 7 2023-09-15 0.1.0 "slweb Library Reference"
+.TH LIBWEB_HANDLER 7 2023-09-15 0.1.0 "libweb Library Reference"
.SH NAME
-slweb_handler \- slweb high-level website configuration
+libweb_handler \- libweb high-level website configuration
.SH SYNOPSIS
.LP
.nf
-#include <slweb/handler.h>
+#include <libweb/handler.h>
.fi
.SH DESCRIPTION
This component provides abstractions that allow library users to
define the behaviour of a web server. Whereas
-.IR slweb_http (7)
+.IR libweb_http (7)
defines the HTTP/1.1 server implementation and provides a data type
(namely
.IR "struct http_ctx" )
to handle an incoming connection,
-.IR slweb_handler (7):
+.IR libweb_handler (7):
.IP \(bu 2
Defines the list of endpoints and supported operations.
.IP \(bu 2
Defines the port
-.I slweb
+.I libweb
must listen to.
.IP \(bu 2
Keeps track of all
.I struct http_ctx
objects.
-.IR slweb_handler (7)
+.IR libweb_handler (7)
provides the following functions:
.IP \(bu 2
@@ -83,7 +83,7 @@ are passed directly to the
object used to initialize a
.I struct http_ctx
object. See
-.IR slweb_http (7)
+.IR libweb_http (7)
for further reference about these members.
However, a
@@ -104,7 +104,7 @@ typedef int (*\fIhandler_fn\fP)(const struct http_payload *\fIp\fP, struct http_
.PP
Please read
-.IR slweb_http (7)
+.IR libweb_http (7)
for further refence on
.I "struct http_payload"
and
@@ -124,16 +124,16 @@ and
\fI/index.html\fP
as its endpoints. For the sake of simplicity, a static response body is
returned, instead of using
-.IR slweb_html (7)
+.IR libweb_html (7)
to generate HTML data. Please read
-.IR slweb_html (7)
+.IR libweb_html (7)
for further reference on how to generate dynamic content.
.PP
.in +4n
.EX
-#include <slweb/handler.h>
-#include <slweb/http.h>
+#include <libweb/handler.h>
+#include <libweb/http.h>
#include <stddef.h>
#include <stdlib.h>
@@ -142,7 +142,7 @@ static int hello(const struct http_payload *const pl,
{
static const char page[] =
{
- "<html><body><p>Hello from slweb!</p></body></html>"
+ "<html><body><p>Hello from libweb!</p></body></html>"
};
*r = (const struct http_response)
@@ -218,7 +218,7 @@ end:
.BR handler_alloc (3),
.BR handler_add (3),
.BR handler_free (3),
-.BR slweb_http (7).
+.BR libweb_http (7).
.SH COPYRIGHT
Copyright (C) 2023 Xavier Del Campo Romero.
diff --git a/doc/man7/slweb_html.7 b/doc/man7/libweb_html.7
index db8e224..c6f864a 100644
--- a/doc/man7/slweb_html.7
+++ b/doc/man7/libweb_html.7
@@ -1,12 +1,12 @@
-.TH SLWEB_HTML 7 2023-09-15 0.1.0 "slweb Library Reference"
+.TH LIBWEB_HTML 7 2023-09-15 0.1.0 "libweb Library Reference"
.SH NAME
-slweb_html \- slweb HTML serializer
+libweb_html \- libweb HTML serializer
.SH SYNOPSIS
.LP
.nf
-#include <slweb/html.h>
+#include <libweb/html.h>
.fi
.SH DESCRIPTION
@@ -14,7 +14,7 @@ This component allows library users to serialize HTML text from a tree
structure composed by one or more
.I struct html_node
objects.
-.IR slweb_html (7)
+.IR libweb_html (7)
provides the following functions:
.IP \(bu 2
@@ -94,13 +94,13 @@ shall free the memory used by the root node and all of its children.
.SH EXAMPLE
The example below is a minimal showcase of some of the features
provided by
-.IR slweb_html (7),
+.IR libweb_html (7),
which prints a minimal HTML file to standard output:
.PP
.in +4n
.EX
-#include <slweb/html.h>
+#include <libweb/html.h>
#include <dynstr.h>
#include <stdlib.h>
#include <stdio.h>
@@ -110,7 +110,7 @@ int main()
int ret = EXIT_FAILURE;
struct dynstr d;
struct html_node *const html = html_node_alloc("html"), *body;
- static const char text[] = "testing slweb";
+ static const char text[] = "testing libweb";
dynstr_init(&d);
@@ -152,7 +152,7 @@ This program should write the following data over standard output:
.in +4n
.EX
<html>
- <body>testing slweb</body>
+ <body>testing libweb</body>
</html>
.EE
.in
@@ -167,7 +167,7 @@ This program should write the following data over standard output:
.BR html_node_add_child (3),
.BR html_node_add_sibling (3),
.BR html_serialize (3),
-.BR slweb_html (7).
+.BR libweb_html (7).
.SH COPYRIGHT
Copyright (C) 2023 Xavier Del Campo Romero.
diff --git a/doc/man7/slweb_http.7 b/doc/man7/libweb_http.7
index 682c378..329a616 100644
--- a/doc/man7/slweb_http.7
+++ b/doc/man7/libweb_http.7
@@ -1,17 +1,17 @@
-.TH SLWEB_HTTP 7 2023-09-15 0.1.0 "slweb Library Reference"
+.TH LIBWEB_HTTP 7 2023-09-15 0.1.0 "libweb Library Reference"
.SH NAME
-slweb_http \- slweb HTTP connection handling and utilities
+libweb_http \- libweb HTTP connection handling and utilities
.SH SYNOPSIS
.LP
.nf
-#include <slweb/http.h>
+#include <libweb/http.h>
.fi
.SH DESCRIPTION
As one of its key features,
-\fIslweb\fR
+\fIlibweb\fR
provides a HTTP/1.1-compatible server implementation that can be
embedded into applications as a library. While not a complete HTTP/1.1
server implementation, the following features are supported:
@@ -42,7 +42,7 @@ The functions listed below are meant for library users:
.SS HTTP connection-related functions
The functions listed below are meant for internal use by
-.IR slweb :
+.IR libweb :
.IP \(bu 2
.IR http_alloc (3).
@@ -56,7 +56,7 @@ For example, a list of endpoints is required to define its behaviour,
and
.I struct http
objects must be stored somewhere as long as the connections are active.
-.IR slweb_handler (7)
+.IR libweb_handler (7)
is the component meant to provide the missing pieces that conform a
working web server.
@@ -127,7 +127,7 @@ On error, a negative integer is returned.
.I payload
is a function pointer called by
-.I slweb
+.I libweb
when a new HTTP request has been received.
.I p
is a read-only pointer to a
@@ -151,7 +151,7 @@ returned.
.I length
is a function pointer called by
-.I slweb
+.I libweb
when an incoming HTTP request from a client requires to store one or
more files on the server, encoded as
.IR multipart/form-data .
@@ -198,7 +198,7 @@ can be a null pointer.
.SS HTTP payload
When a client submits a request to the server,
-.I slweb
+.I libweb
prepares a high-level data structure, called
.IR "struct http_payload" ,
and passes it to the function pointer defined by
@@ -273,19 +273,19 @@ handles differently:
.IP \(bu 2
.IR application/x-www-form-urlencoded :
suggested for smaller payloads.
-.I slweb
+.I libweb
shall store the payload in memory, limiting its maximum size to
.BR "7999 octets" .
.IP \(bu 2
.IR multipart/form-data :
suggested for larger and/or binary payloads.
-.I slweb
+.I libweb
shall store each non-file name-value pair in memory, limiting the value
length to
.BR "8000 octets" .
On the other hand,
-.I slweb
+.I libweb
shall store each file into the temporary directory defined by
.I struct http_cfg
member
@@ -377,7 +377,7 @@ shall be a null pointer.
.SS HTTP responses
Some function pointers used by
-.I slweb
+.I libweb
require to initialize a
.I "struct http_response"
object that defines the response that must be sent to the client.
@@ -437,7 +437,7 @@ is a read-only opaque pointer to a buffer in memory, whose length is
defined by
.I n
(see definition below).
-.I slweb
+.I libweb
shall select
.I ro
as the output payload if both
@@ -452,7 +452,7 @@ is non-zero.
is an opaque pointer to a buffer in memory, whose length is defined by
.I n
(see definition below).
-.I slweb
+.I libweb
shall select
.I rw
as the output payload if both
@@ -471,7 +471,7 @@ is a
pointer opened for reading that defines the payload to be sent to the
client, whose length is defined by
.IR n .
-.I slweb
+.I libweb
shall select
.I f
as the output payload if
@@ -514,20 +514,20 @@ must be a null pointer.
.SS Transport Layer Security (TLS)
By design,
-.I slweb
+.I libweb
does
.BI not
implement TLS (Transport Layer Security). It is assumed this should
be provided by a reverse proxy instead, a kind of project that is
usually maintained by a larger community than
-.I slweb
+.I libweb
and audited for security vulnerabilities.
.SH NOTES
.SS Comparing against other HTTP server implementations
While it is well understood that other solutions provide fully-fledged
server implementations as standalone executables,
-.I slweb
+.I libweb
strives to be as small and easy to use as possible, intentionally
limiting its scope while covering a good range of use cases.
@@ -550,13 +550,13 @@ or
.BR -- .
This means it is not possible for
-.I slweb
+.I libweb
to determine the number of files or their lengths in a HTTP request
unless the whole request is read, which not might be possible for large
requests. Therefore, the
.B Content-Length
is the only rough estimation
-.I slweb
+.I libweb
can rely on, and therefore is the value passed to the
.I length
function pointer in
@@ -568,7 +568,7 @@ function pointer in
The handling of
.B 100-continue
requests is not done correctly:
-.I slweb
+.I libweb
calls the function pointed to by
.I "struct http_cfg"
member
@@ -581,7 +581,7 @@ headers are processed.
.SH FUTURE DIRECTIONS
.SS Limitations on the number of HTTP cookies
So far,
-.I slweb
+.I libweb
shall only append at most
.B one
HTTP cookie to a
@@ -599,12 +599,12 @@ object containing the number of HTTP cookies in the request.
.SS Handling application/x-www-form-urlencoded data
Due to historical reasons,
-.I slweb
+.I libweb
treated
.IR application/x-www-form-urlencoded -data
as a binary blob. While this was changed to a null-terminated string in
order to allow applications to avoid unnecessary memory allocations,
-.I slweb
+.I libweb
still does not decode the data, instead forcing applications to do so.
Future versions of this library shall replace
.I "struct http_post"
@@ -622,7 +622,7 @@ as a union that only holds one possible data type. While this might
look counterintuitive, this is because
.B POST
is the only HTTP/1.1 operation
-.I slweb
+.I libweb
supports that requires to store a payload. However, future versions of
this library might extend its support for other HTTP/1.1 operations
that could require to store a payload, while keeping the memory