Add RHIZOME_BUNDLE_STATUS_MANIFEST_TOO_BIG enum option to indicate
that the manifest exceeded 8 KiB in size.
Refactor rhizome_add_manifest() and rhizome_manifest_finalise()
to return 'struct rhizome_bundle_result' instead of 'enum
rhizome_bundle_status', so that that their detailed failure messages
can reach the HTTP API layer instead of just being logged.
Fix HTTP response status codes produced Rhizome direct HTTP requests
to be consistent with the Rhizome RESTful API.
- Introduce the new 'struct rhizome_bundle_result' that contains a
rhizome_bundle_status enum value and an optional, nul-terminated
string that provides an explanation of the cause of the status; add
functions to construct, query, and free the struct
- Replace 'enum rhizome_add_result' with 'struct rhizome_bundle_result',
removing an unnecessary level of enum interpretation
- Make rhizome_fill_manifest() return 'struct rhizome_bundle_result' and
add logic to check that the supplied author SID is correct (previous
behaviour was: if an incorrect author SID was supplied but the correct
author could be found in the keyring, then the incorrect one was
silently ignored)
- Simplify the response code in rhizome_restful.cc to take advantage of
the new 'struct rhizome_bundle_result'; in particular, the mapping
from 'enum rhizome_bundle_status' codes to HTTP status codes is now
expressed in a single switch statement
- Fix some minor failures in test scripts revealed by the changes
In 'struct http_response', rename the 'result_code' field to
'status_code' for consistency with the terminology used in the HTTP
specification, and add a 'reason' field, so that the phrase that
appears in the first response line can differ from the standard
"canned" phrases.
Recent addition of the GCC __attribute__(alloc_size) to some functions
in mem.h broke the build when using Clang 3.5. This commit introduces
configure-time checks for all GCC attributes used in the Serval source
code, and adapts accordingly.
If strbuf_local(buf, len) is called with a buffer whose size can be
deduced at compile time, then this change will check that 'len' does not
exceed that size, causing an assertion failure at run time if it does.
The safety check makes use of the GCC extensions: __builtin_object_size()
and __attribute__((alloc_size(n)). Under non-GCC compilers, the safety
check will not be performed.
Internally the strbuf_local_buf(x) macro uses sizeof(x) to determine
the size of the buffer, but this will give the wrong behaviour if x
is a pointer (char *x), not an array (char x[]). With this change,
invoking it with a pointer will cause a compile error.
The safety check makes use of the GCC extensions: __builtin_object_size()
and __attribute__((alloc_size(n)). Under non-GCC compilers, the safety
check will not be performed.
Need a way for the client to distinguish between authenticated (certain)
and unauthenticated (likely) author SIDs in the context of a bundle list,
since the bundle list does not verify manifest signatures for performance
and battery life reasons.
List all the HTTP status codes in the REST API tech doc.
Only use 403 Forbidden for requests originating from a disallowed
origin (ie, not localhost).
- Return 400 for missing, unknown, duplicate and out-of-order form
parts in POST requests.
- Return 415 Unsupported Media Type for unsupported form part
Content-Disposition and Content-Type (including unsupported
charset).
- Return 414 Request-URI Too Long for any buffer exhaustion while
parsing request.
- Return 419 Authentication Timeout for missing crypto secret.
The ALARM_STRUCT() and DECLARE_TRIGGER() macros included terminating
semicolons, but their invocation should always be followed by a
semicolon, otherwise etags(1) gets confused, so their included semicolon
was redundant.
GCC 4.9 and later warn about unused values produced by the comma
operator. Since the -Wno-unused-value option was removed from the
non-Android Makefile.in, it will not compile the WHY() macro and its
variants, with the -Wall option.
This commit removes the comma operator from the WHY() macro and its
variants, and replaces it with a new inline wrapper function.
This commit also removes the WHYNULL() macro and fixes the three places
it was used.