Response: set TCP_CORK OFF after send the HTTP headers

After a callback, Duda send the HTTP headers through Monkey API,
but Monkey API per design let TCP_CORK ON in the socket in case
the caller wanted to send more data in the same round.

This patch disable TCP_CORK after send the headers and flush
some enqueued data.

Bonus track:
------------
The lesson of the day Feb 2, 2013: I must NEVER forget that when
sending the HTTP headers, Monkey sets the TCP_CORK flag ON in the
socket in case the caller wanted to send more data so we let know
the Kernel to buffer a little more bytes. If we do not set TCP_CORK
to OFF we will face some delays in the response. KeepAlive was very slow
due to this bug. More than 4 hours to found this silly bug.

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Core: new recycle feature to handle KeepAlive request

In order to provide a constant performance and protect memory
consumption, a new recycle feature have been added. Every time the
connection is under a KeepAlive connection, it recycle the memory
used to handle the main data structure for the internal work of the
web service.

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Conf: fix string length variable for DocumentRoot key

When a DocumentRoot key is specified in the virtual host configuration
and it do not end with a slash, the slash is added at the end but it
was setting the wrong string length for the mk_pointer. Leading in a
problem when trying to map a static path inside the service.

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Static Map: validate if the callback exists. On error abort

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Websocket: fix payload zero-ing

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Core: deprecate 'recycle' routines

Due to the new implementation of 'dr list' per thread, is not longer
necessary the recycle feature recently introduced to recycle duda_request_t
memory allocations on keepalive requests.

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Core: fix order when releasing resources on service_end()

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Update file headers with proper title and copyright

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Static/Map: fix order of routes map validation

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
data: new 'data' object

The new 'data' object introduce the concept of data directory
per web service. This means that each web service can define a
specific directory to be used as an application repository to
upload files or to have something specific related to the web
service that must not be public through HTTP.

The methods implemented are:

   const char *get_path();
   int set_path(const char *dir);
   char *locate(const char *filename);

For more details of API usage of this object refer to:

   http://duda.io/api/data.html

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

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

Note: patch that add multiple things, worked in a non-git repo.

- The stack now is able to serve static content from built-in features
through a fixed directory path set through a new configuration key
in duda.conf named. DocumentRoot. This content is web-service
agnostic and the content is mapped through the address http://host/ddr/,
where 'ddr' refers to 'Duda Document Root'.

This feature is fundamental to render internal content pages with
specific data.

- Console/Map: the console map have been improved and now the routes are
separated by static map or interface/methods. All content is rendered
using the Bootstrap framework.

- Configuration template adds #LIBDIR# macro and adds new path for
the htdocs directory

- New internal call duda_override_docroot() to override a document root
for a given incoming request, the doc root is set initially by the vhost
and then overrided by Duda core, taking care of populate session_request
struct properly.

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Query String: fix comparisson when retrieving some variable

Under similar variables in the query string, the API was returning
the value of the shorter variable name without compare the lenght
string. E.g: if exists two keys 'd' and 'data', it always return
the value of 'd' when quering for 'd' and 'data'.

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Core: move API macros inside the structs

Before this patch, each API function that required to be expanded
through a macro by the pre-processor, was being declared as global,
this generated some issues when two API objects had similar function
names, in some cases the macro were overriden.

This patch put each API macro inside the struct, so we keep the references
protected to avoid any override.

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Map: fix static order lookup

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Static: add Null delimiter byte when overriding document root

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Merge remote branch 'upstream/master'