Commit graph

6 commits

Author SHA1 Message Date
Laslo Hunhold
6b55e36036 Introduce flag-centric usage
The config.h-interface has proven to be very effective for a lot of
suckless tools, but it just does not make too much sense for a web
server like quark.

 $ quark

If you run multiple instances of it, you want to see in the command line
(or top) what it does, and given the amount of options it's logical to
just express them as options given in the command line.
It also is a problem if you can modify quark via the config.h,
contradicting the manual. Just saying "Well, then don't touch config.h"
is also not good, as the vhost and map options were only exposed via
this interface.

What is left in config.h are mime-types and two constants relating to
the incoming HTTP-header-limits.

In order to introduce these changes, some structs and safe utility
functions were added and imported from OpenBSD respectively.
2018-03-05 00:14:25 +01:00
Laslo Hunhold
7b7f166dd5 Add target prefix mapping
This allows e.g. to redirect when a directory has been moved.
2018-02-27 12:43:05 +01:00
Laslo Hunhold
02d6ae5a57 Add support for adding a prefix to a target when matching vhosts
This makes quark's vhost-handling very powerful while still being
simple.

Imagine you have a website with a subdomain you really want
to move back to your main domain.
Say the subdomain is called "old.example.org" and you want to serve it
under "example.org" but in the subdirectory "old/", i.e. you want to
redirect a request "old.example.org/subdir/" to "example.org/old/subdir".

For a vhost-handler that only takes 4 arguments for each vhost this is
actually pretty powerful.
2018-02-27 11:36:24 +01:00
Laslo Hunhold
4948053bee Use scheme-relative (aka protocol-relative) URLs for redirects
This ensures that quark really does not care if the incoming connection
is plain HTTP or relayed TLS-traffic from a proxy or tunnel. Depending
on the previous negotiation, the client will make the right decision on
which scheme to use in a given context.
2018-02-27 03:38:55 +01:00
Josuah Demangeon
55d7f000cd add headers to make it compile under OpenBSD
- 'struct in6_addr' is defined in <netinet/in.h>
- 'AF_INET6' is defined in <sys/socket.h>
2018-02-12 20:35:37 +01:00
Laslo Hunhold
ccdb51b96d Refactor the single source file into multiple modules
And many other things, too many to list here. For example, it now
properly logs uds instead of erroring out.
Separating concerns in many places definitely improves the readability.
2018-02-04 21:27:33 +01:00