memory: Calloc is much faster than malloc+memset.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
utils: Add a gmt text cache for utime2gmt

In the worst case (no cache hit ever), the overhead for utime2gmt is little less than 1%.
In the best case (cache hits always), drops utime2gmt cpu usage from 9.6% to 1.2%.

Helps in mixed usage, since often accessed pages like the index page stay in the
cache.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
utils: optimize utime2gmt when the entry does not hit the cache

This patch reduce the number of char assignation to the target buffer
replacing a few of them with the memcpy() call.

Using valgrind is possible to see that the optimization helps to reduce
the computing time from 2.73 to 2.34.

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
http: Remove the _status_ functions and list, all unused

Besides cleaner code, runtime RAM use drops by 1.3kb.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
http: use memmem for the ".." check

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
htdocs: corrected image path

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
memory: realloc had wrong size hint

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Duda: drop plugin (new repo has been created)

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Readme: add requirements section

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Config: add new DefaultMimeType configuration key

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Logger: if content length is not set in headers, use zero

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
http: Remove unused arg from mk_http_keepalive_check

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
main: Use malloc_z for the config struct

Valgrind found an uninitialized use. Initializing to zero fixes that.

Conditional jump or move depends on uninitialised value(s)
    at 0x406D28: mk_utils_register_pid (mk_utils.c:411)
    by 0x402CD5: main (monkey.c:168)

Signed-off-by: Lauri Kasanen <cand@gmx.com>
request: on premature close, make sure a default vhost details exists

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
request: Optimize mk_request_init, v2

This both simplifies the code, and moves the function from 1.6% to 0.4% of
Monkey CPU time.

Changelog:
	v2 - Removed one forgotten zero set

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
QA: fix and add missing error_413_02.htt file

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
http: fix a validation over if-modified-since

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
utils: add MK_TRACE_BACKGROUND env var for trace mode

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Build system: Automatic dependencies for the header files

This removes the need to "make clean" after editing a header file.
All C files that need recompiling are automatically rebuilt.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Builder: compile output like Linux Kernel style

Makefiles has been modified to print out messages like the Linux
Kernel at compile time:

 edsiper@monotop:~/coding/monkey$ make
   CC    src/monkey.o
   CC    src/mk_method.o
   CC    src/mk_mimetype.o
   CC    src/mk_request.o
   CC    src/mk_header.o
   CC    src/mk_config.o
   CC    src/mk_signals.o
   CC    src/mk_user.o
   CC    src/mk_utils.o
   CC    src/mk_epoll.o
   CC    src/mk_scheduler.o
   ...

Signed-off-by: Eduardo Silva <edsiper@gmail.com>