Commit graph

20 commits

Author SHA1 Message Date
Laslo Hunhold
660b308617
Use timegm() instead of mktime() to generate UNIX-timestamp
The broken down time-representation tm generated earlier is in UTC,
and mktime() assumes that it's in local time instead, leading to
the problem that quark might not send a NOT_MODIFIED in a different
timezone.

timegm() instead correctly interprets the broken down
time-representation tm as UTC and returns the proper timestamp.
It might not be portable like mktime(), but it's complicated to
emulate it otherwise.

Thanks to Jeremy Bobbin <jer@jer.cx> for reporting the bug and
providing this fix, which is why I've added him to the LICENSE.
Thanks also to Hiltjo for his input.

Signed-off-by: Laslo Hunhold <dev@frign.de>
2020-07-23 16:48:34 +02:00
Laslo Hunhold
a55df3915d
Update LICENSE
Signed-off-by: Laslo Hunhold <dev@frign.de>
2020-05-07 13:41:11 +02:00
Laslo Hunhold
9dda0028db
Update LICENSE
Signed-off-by: Laslo Hunhold <dev@frign.de>
2020-04-21 17:48:20 +02:00
Aaron Burrow
d2013a6337 Fix one byte NULL stack overflow
Don't append a forward slash if the length of a folder is PATH_MAX-1. This can
happen if HEADER_MAX is larger than PATH_MAX or if the `-m` option is used to
increase the path length.
2018-07-16 22:48:20 +02:00
Laslo Hunhold
b354ffb238 Add Dominik Schmidt to license 2018-07-02 07:15:19 +02:00
Hiltjo Posthuma
01ed0dac83 util: don't initialize server, it's already done in main()
... this removes a stupid compiler warning too.
2018-03-05 01:00:50 +01:00
Quentin Rameau
3ff3e5ea6e Add some missing headers and interface visibility macro
strings.h for strncasecmp
time.h for strptime
2018-03-05 00:21:54 +01:00
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
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
2c74631df9 Update LICENSE 2018-02-04 21:33:33 +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
Laslo Hunhold
3a7c6ec0b9 Change the license formatting a bit to be in line with the OSI
The (c)-symbol has become more of a remnant after the Berne convention
has been signed. Given the ISC exploits some simplifications introduced
with the Berne convention, it just makes sense to drop this relict as
well and just state our Copyright without much ado about nothing.

https://opensource.org/licenses/ISC
2017-08-04 17:14:02 +02:00
Laslo Hunhold
06eba20e9d Add Quentin to LICENSE 2017-07-11 13:46:31 +02:00
Hiltjo Posthuma
96d035b284 add myself to the license (contributor) 2017-06-27 23:31:08 +02:00
Laslo Hunhold
6347e2ec3e Rewrite quark from the ground up again
I noticed that the data structures didn't allow a flexible handling of
the code while trying to extend it to support if-modified-since-responses.
To tackle this, I refactored the data structures and proceeded to
rewrite the server from the ground up, implementing all present features
plus fixing a lot of bugs and introducing the 304 header handling as
requested by many people.

Please report bugs if you find them.

While at it, I refactored the build system as well and updated all
surrounding files respectively.
2017-06-20 21:40:00 +02:00
FRIGN
0ce86bba15 Initial commit of quark rewrite
Roughly 700 LOC (half of the old quark on the Hiltjo branch) in size,
this rewrite supports partial content and other good stuff that will
make it fun again to use quark for simple static purposes.
The error checking is rigorous and strict and it will report proper
error codes back to the client whenever there was a problem or the
request was invalid in some way.

A cool feature is the support for listening on a UNIX-domain socket,
which will in the long run allow us to solve problems with virtual hosts
and other things in separate programs. But until then, this should be
robust enough for most use-cases.

This resets quark's version to 0, but this was no problem as there
haven't been any quark releases yet.

Feedback is appreciated.
2016-09-02 09:59:02 +02:00
FRIGN
0e8cac1ee4 Prepare repository for rewrite
It was sad to see that quark never got the attention it deserved in my
opinion. However, there were good reasons why that was the case.

The project lost focus by trying to add CGI support, which in all
fairness worked only half of the time.
For the rest of the use cases, a static server to make it dead simple to
publish a directory, it was also pretty bad, given it does not support
partial content. Seeking in a mp3 was impossible and it was very
frustrating.

Long ago we discussed in the team how exciting it would be to test out
new concepts of having a web server that listens on a UNIX-domain
socket, potentially allowing new concepts for realizing virtual hosts
and other things.

It took me half a year to make the decision to rewrite quark, so it is
now time to purge the repo and push the initial commit.
2016-09-02 09:46:01 +02:00
FRIGN
c3d007756e Add arg-parser and move copyright-info to LICENSE 2014-07-28 13:42:26 +02:00
Anselm R Garbe
a61a51b91d applied Szabolcs patch, added him to LICENSE 2011-02-13 12:46:34 +00:00
Anselm R Garbe
ce31aca1aa initial commit 2009-08-15 19:56:11 +01:00