Commit graph

36 commits

Author SHA1 Message Date
FRIGN
10416a352b Coding style 2014-08-08 16:46:01 +02:00
FRIGN
f915f82a40 Refactor responsefile()
Add some comments and improve coding-style.
2014-08-08 15:37:27 +02:00
FRIGN
68535cc04f Use ssize_t for read- and write-return-values 2014-08-08 14:23:12 +02:00
FRIGN
a345c63a59 Refactor sighandler
You can't handle SIGKILL. Given we have control over which
signals are passed to the sighandler, it's enough to catch SIGCHLD
and do standard behaviour than building a big switch for that.
2014-08-07 17:24:39 +02:00
FRIGN
92b8bc27da Refactor loop inside writedata()
Use for for this stuff.
2014-08-07 17:02:03 +02:00
FRIGN
76834092d7 Unify return values
This is the first step for unifying the return-values inside quark.

 1: error
 0: success
-1: not found (non-fatal, for instance, if you run getresentry
               on a non-essential entry)
2014-08-07 16:56:28 +02:00
FRIGN
5ffad8984a Use named indices for the response-entry-array
It was actually sitting right in front of my eyes in the
sighandler-funtion.
This will help sort out ambiguities or mixing up array-indices.
2014-08-07 16:34:46 +02:00
FRIGN
1e23378afd Use strsignal() for signal-logging
This also makes clearer what happens when you do not know the
abbreviations well.
2014-08-07 16:28:01 +02:00
Adria Garriga
abec80e6ce Fixed buffer overflow when p-res==targetlen in function getreqentry 2014-08-07 02:20:13 +02:00
FRIGN
e9408312e1 Refactor response-constructors
Instead of providing a function for each entry-type, use a small
static lookup-table and one function to rule them all.
In the future, in case the list grows, we might think about
implementing it with a small hash-lookup, but currently,
it's easy enough synchronizing the enum and the array.

While at it, improve the logic in the code itself
by using logical OR's instead of AND's.
2014-08-06 17:47:56 +02:00
FRIGN
6d5bedd72a Refactor request()
Unite duplicate code in the getreqentry() function, making error-checking
much easier, and, more importantly, drastically increase the readability.
2014-07-28 15:30:56 +02:00
FRIGN
c3d007756e Add arg-parser and move copyright-info to LICENSE 2014-07-28 13:42:26 +02:00
FRIGN
dfd68c48be Add arg.h 2014-07-28 13:33:58 +02:00
Hiltjo Posthuma
7cd3150df7 implement http not modified
On each request send "last-modified" header with the modification time of
each file. the client will store this field and send it on the next
request(s). On the server check the "if-modified-since" field with the
modified date sent by the client, depending on this send all the data or
the "304 not modified" http status.

CAVEAT: it is assumed the exact field will be send by the client, no date/time
conversion is done for simplicity sake, as far as that's possible with http ;)
2014-07-27 11:37:25 +01:00
Hiltjo Posthuma
dfda73adf1 remove unused code 2014-07-27 11:37:21 +01:00
Jakob Kramer
101a5b5eaf correct information in README 2014-04-12 12:26:14 +01:00
Hiltjo Posthuma
31e023dcb4 http status moved permanently is code 301
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-03-07 15:06:03 +00:00
garbeam@gmail.com
22b5b3cfa6 applied cls' follow up fix 2011-06-26 10:57:34 +01:00
garbeam@gmail.com
3a9701d828 applied rransom's quark patch for FreeBSD compliance, thanks 2011-06-26 10:51:42 +01:00
Anselm R Garbe
d6cbb5b9d9 preparing Request abstraction, ongoing 2011-02-16 20:29:55 +00:00
Anselm R Garbe
a61a51b91d applied Szabolcs patch, added him to LICENSE 2011-02-13 12:46:34 +00:00
Anselm R Garbe
0c7cc24c83 removed non-existent man page install 2010-04-10 21:34:05 +01:00
Anselm R Garbe
5e9814c847 made simple CGI working, quark can be used to run werc 2010-03-28 11:31:30 +00:00
Anselm R Garbe
18c6c2451d some minor fix 2010-03-28 02:18:34 +00:00
Anselm R Garbe
3e45a7c0ba added command line interface 2010-03-28 02:14:01 +00:00
Anselm R Garbe
a20243ea7c added basic HEAD support, some bug fixes 2010-03-28 01:57:44 +00:00
Anselm R Garbe
07db66c273 implemented very basic cgi support 2010-03-28 01:09:14 +00:00
Anselm R Garbe
c19e5e6724 moved signal handlers before port binding 2009-08-16 13:33:02 +01:00
Anselm R Garbe
1301be6ce8 superflous, stderr is unbuffered 2009-08-16 11:51:14 +01:00
Anselm R Garbe
15edad07bb sanity check 2009-08-15 22:59:41 +01:00
Anselm R Garbe
4b8f562095 forget to close cfd in parent ;) 2009-08-15 22:37:29 +01:00
Anselm R Garbe
5dfc25167d another version, behaves better under stress 2009-08-15 22:25:22 +01:00
Anselm R Garbe
c05e00039f some el cheapo handle release 2009-08-15 22:11:26 +01:00
Anselm R Garbe
c621fad3de update 2009-08-15 20:01:53 +01:00
Anselm R Garbe
7b020e8c51 changed some docs 2009-08-15 19:57:15 +01:00
Anselm R Garbe
ce31aca1aa initial commit 2009-08-15 19:56:11 +01:00