Was returning status 500 if Authorization: Basic token was long, because
_reserve() did not have enough free space at start of buffer. The
solution was to _commit(r) before attempting the _reserve_str() calls
for the decoded username and password.
As a separate issue, the status 500 also triggered an assertion failure
because http_request_parse_header() was returning 400 but
response.result_code had already been set to 500.
Make .o files in separate subdirectories for servald and library
Factor struct __sourceloc and __WHENCE__ from "log.h" into "whence.h"
Factor sid_t etc from "serval.h" into "serval_types.h"
Factor rhizome_bid_t etc from "rhizome.h" into "rhizome_types.h"
Do not include "serval.h" in library sources
Add log_stderr.c and logMessage.c for stand-alone executables
Change HTTP request buffer pointers from (const char*) to (char*)
because some Rhizome operations can modify received data in-place, eg,
when decrypting it.
Write test case assertions using jq(1) utility, increase from four
bundles to 100.
Fix bugs in HTTP server content generation logic.
Make payload content generator read payload 4KiB at a time, to
always read on filesystem block boundaries for performance. Increase
size of payload in relevant test case.
Content generator functions now take arguments describing the buffer
they are to fill, and respond with a struct containing the number of
bytes filled, and the number of free bytes needed before being called
again.
The HTTP response logic now fills the buffer as much as possible before
calling write(2) by topping it up instead of waiting for it to be
completely emptied before generating more content.
Support generated content with an unspecified Content-Length. Generator
functions return 1 if there is more content to come, and 0 if they have
just produced the last piece of content.
The C standard defines the difference between two (char*) pointers is
defined to be either short, int or long. Not long long (64 bits). On
64-bit systems, logging "%"PRIhttp_size_t (int64_t) for pointer
difference works by coincidence because a long or int is 64 bits, but
causes SEGV on 32 bit platforms.
The portable solution is to log pointer differences using "%d" and
explicitly cast the pointer difference to (int) in the arg list, or
"%ld" and cast it to (long).
So that "http_server.h" does not have to include "serval.h" which
creates a circular dependency.
Remove the __SERVALDNA__HTTP_SERVER_IMPLEMENTATION hack from
"http_server.h"