Update the documentation to reflect the new flag-centric usage
This commit is contained in:
parent
444b8f5b32
commit
a20136fa18
4 changed files with 97 additions and 42 deletions
2
http.c
2
http.c
|
@ -336,7 +336,7 @@ http_send_response(int fd, struct request *r)
|
||||||
return http_send_status(fd, (errno == EACCES) ?
|
return http_send_status(fd, (errno == EACCES) ?
|
||||||
S_FORBIDDEN : S_NOT_FOUND);
|
S_FORBIDDEN : S_NOT_FOUND);
|
||||||
}
|
}
|
||||||
vhostmatch = s.vhost[i].name;
|
vhostmatch = s.vhost[i].chost;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
6
main.c
6
main.c
|
@ -94,10 +94,10 @@ static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
const char *opts = "[-u user] [-g group] [-n num] [-d dir] [-l] "
|
const char *opts = "[-u user] [-g group] [-n num] [-d dir] [-l] "
|
||||||
"[-i index] [-v vhost] ... [-m map] ...";
|
"[-i file] [-v vhost] ... [-m map] ...";
|
||||||
|
|
||||||
die("usage: %s -h host -p port %s\n"
|
die("usage: %s -h host -p port %s\n"
|
||||||
" %s -U socket [-p port] %s", argv0,
|
" %s -U file [-p port] %s", argv0,
|
||||||
opts, argv0, opts);
|
opts, argv0, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ main(int argc, char *argv[])
|
||||||
sizeof(struct vhost)))) {
|
sizeof(struct vhost)))) {
|
||||||
die("reallocarray:");
|
die("reallocarray:");
|
||||||
}
|
}
|
||||||
if (!(s.vhost[s.vhost_len - 1].name = strtok(tok, " ")) ||
|
if (!(s.vhost[s.vhost_len - 1].chost = strtok(tok, " ")) ||
|
||||||
!(s.vhost[s.vhost_len - 1].regex = strtok(NULL, " ")) ||
|
!(s.vhost[s.vhost_len - 1].regex = strtok(NULL, " ")) ||
|
||||||
!(s.vhost[s.vhost_len - 1].dir = strtok(NULL, " ")) ||
|
!(s.vhost[s.vhost_len - 1].dir = strtok(NULL, " ")) ||
|
||||||
!(s.vhost[s.vhost_len - 1].prefix = strtok(NULL, " ")) ||
|
!(s.vhost[s.vhost_len - 1].prefix = strtok(NULL, " ")) ||
|
||||||
|
|
127
quark.1
127
quark.1
|
@ -1,65 +1,120 @@
|
||||||
.Dd 2018-02-05
|
.Dd 2018-03-05
|
||||||
.Dt QUARK 1
|
.Dt QUARK 1
|
||||||
|
.Os suckless.org
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm quark
|
.Nm quark
|
||||||
.Nd simple web server
|
.Nd simple static web server
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl l | L
|
.Fl h Ar host
|
||||||
.Op Fl v | V
|
.Fl p Ar port
|
||||||
.Oo
|
|
||||||
.Oo
|
|
||||||
.Op Fl h Ar host
|
|
||||||
.Op Fl p Ar port
|
|
||||||
.Oc
|
|
||||||
|
|
|
||||||
.Op Fl U Ar sockfile
|
|
||||||
.Oc
|
|
||||||
.Op Fl d Ar dir
|
|
||||||
.Op Fl u Ar user
|
.Op Fl u Ar user
|
||||||
.Op Fl g Ar group
|
.Op Fl g Ar group
|
||||||
|
.Op Fl n Ar num
|
||||||
|
.Op Fl d Ar dir
|
||||||
|
.Op Fl l
|
||||||
|
.Op Fl i Ar file
|
||||||
|
.Oo Fl v Ar vhost Oc ...
|
||||||
|
.Oo Fl m Ar map Oc ...
|
||||||
|
.Nm
|
||||||
|
.Fl U Ar file
|
||||||
|
.Op Fl p Ar port
|
||||||
|
.Op Fl u Ar user
|
||||||
|
.Op Fl g Ar group
|
||||||
|
.Op Fl n Ar num
|
||||||
|
.Op Fl d Ar dir
|
||||||
|
.Op Fl l
|
||||||
|
.Op Fl i Ar file
|
||||||
|
.Oo Fl v Ar vhost Oc ...
|
||||||
|
.Oo Fl m Ar map Oc ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
is a simple HTTP GET only web server that can be multiplexed using
|
is a simple HTTP GET/HEAD-only web server for static content.
|
||||||
UNIX-domain sockets.
|
|
||||||
.Sh OPTIONS
|
.Sh OPTIONS
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Fl d Ar dir
|
.It Fl d Ar dir
|
||||||
Serve
|
Serve
|
||||||
.Ar dir
|
.Ar dir
|
||||||
after chrooting into it.
|
after chrooting into it.
|
||||||
.It Fl l
|
The default is ".".
|
||||||
Disable directory listing.
|
|
||||||
.It Fl L
|
|
||||||
Enable directory listing.
|
|
||||||
.It Fl g Ar group
|
.It Fl g Ar group
|
||||||
Set group ID to the ID of
|
Set group ID when dropping privileges, and in socket mode the group of the
|
||||||
.Ar group
|
socket file, to the ID of
|
||||||
when dropping privileges.
|
.Ar group .
|
||||||
|
The default is "nogroup".
|
||||||
.It Fl h Ar host
|
.It Fl h Ar host
|
||||||
Use
|
Use
|
||||||
.Ar host
|
.Ar host
|
||||||
as the server hostname.
|
as the server hostname.
|
||||||
|
.It Fl i Ar file
|
||||||
|
Set
|
||||||
|
.Ar file
|
||||||
|
as the directory index.
|
||||||
|
The default is "index.html".
|
||||||
|
.It Fl l
|
||||||
|
Enable directory listing.
|
||||||
|
.It Fl m Ar map
|
||||||
|
Add the target prefix mapping rule specified by
|
||||||
|
.Ar map ,
|
||||||
|
which has the form
|
||||||
|
.Qq Pa chost from to ,
|
||||||
|
where each element is separated with whitespace.
|
||||||
|
.Pp
|
||||||
|
The prefix
|
||||||
|
.Pa from
|
||||||
|
of all matching targets, especially only of those requests for the canonical
|
||||||
|
virtual host
|
||||||
|
.Pa chost
|
||||||
|
when virtual hosts are specified, is then replaced with
|
||||||
|
.Pa to .
|
||||||
|
If no virtual hosts are given,
|
||||||
|
.Pa chost
|
||||||
|
is ignored.
|
||||||
|
.It Fl n Ar num
|
||||||
|
Set the maximum number of threads to
|
||||||
|
.Ar num .
|
||||||
|
The default is 512.
|
||||||
.It Fl p Ar port
|
.It Fl p Ar port
|
||||||
Listen on port
|
In host mode, listen on port
|
||||||
.Ar port
|
.Ar port
|
||||||
for incoming connections.
|
for incoming connections.
|
||||||
.It Fl u Ar user
|
In socket mode, use
|
||||||
Set user ID to the ID of
|
.Ar port
|
||||||
.Ar user
|
for constructing proper virtual host
|
||||||
when dropping privileges.
|
redirects on non-standard ports.
|
||||||
.It Fl U Ar sockfile
|
.It Fl U Ar file
|
||||||
Create the UNIX-domain socket file
|
Create the UNIX-domain socket
|
||||||
.Ar sockfile ,
|
.Ar file ,
|
||||||
listen on it for incoming connections and remove it on exit.
|
listen on it for incoming connections and remove it on exit.
|
||||||
Its user and group owners are equal to the user and group IDs used for dropping
|
.It Fl u Ar user
|
||||||
privileges to.
|
Set user ID when dropping privileges,
|
||||||
.It Fl v
|
and in socket mode the user of the socket file,
|
||||||
Disable virtual hosts.
|
to the ID of
|
||||||
.It Fl V
|
.Ar user .
|
||||||
Enable virtual hosts.
|
The default is "nobody".
|
||||||
|
.It Fl v Ar vhost
|
||||||
|
Add the virtual host specified by
|
||||||
|
.Ar vhost ,
|
||||||
|
which has the form
|
||||||
|
.Qq Pa chost regex dir prefix ,
|
||||||
|
where each element is separated with whitespace.
|
||||||
|
.Pp
|
||||||
|
A request matching the virtual host regular expression
|
||||||
|
.Pa regex
|
||||||
|
(see
|
||||||
|
.Xr regex 3)
|
||||||
|
is redirected to the canonical host
|
||||||
|
.Pa chost ,
|
||||||
|
if they differ, using the directory
|
||||||
|
.Pa dir
|
||||||
|
as the root directory, optionally prefixing the target with
|
||||||
|
.Pa prefix .
|
||||||
|
If any virtual hosts are specified, all requests on non-matching
|
||||||
|
hosts are discarded.
|
||||||
.El
|
.El
|
||||||
.Sh CUSTOMIZATION
|
.Sh CUSTOMIZATION
|
||||||
.Nm
|
.Nm
|
||||||
can be customized by creating a custom config.h from config.def.h and
|
can be customized by creating a custom config.h from config.def.h and
|
||||||
(re)compiling the source code. This keeps it fast, secure and simple.
|
(re)compiling the source code. This keeps it fast, secure and simple.
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Laslo Hunhold Aq Mt dev@frign.de
|
||||||
|
|
2
util.h
2
util.h
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
/* main server struct */
|
/* main server struct */
|
||||||
struct vhost {
|
struct vhost {
|
||||||
char *name;
|
char *chost;
|
||||||
char *regex;
|
char *regex;
|
||||||
char *dir;
|
char *dir;
|
||||||
char *prefix;
|
char *prefix;
|
||||||
|
|
Loading…
Reference in a new issue