Commit Graph

2934 Commits

Author SHA1 Message Date
Andrew Bettison
b37e27f5da Improve HTTP server multipart body parsing
Every handler function can return an HTTP response status code
to terminate request parsing and start the response.
2013-12-27 19:07:00 +10:30
Andrew Bettison
9ebef81a49 Formalise "rhizome add file" exit status
Formalise add-bundle result in "enum rhizome_bundle_status"

Rewrite rhizome_manifest_finalise(), rhizome_find_duplicate() and
rhizome_add_manifest() to return enum rhizome_bundle_status

New function rhizome_manifest_check_stored() that compares a manifest
with its stored counterpart and returns enum rhizome_bundle_status

Remove redundant rhizome_manifest_check_sanity(), consolidating all
manifest validation rules in rhizome_manifest_validate(), which now
checks the 'id' field is present, and that 'sender' and 'recipient' are
both present for MeshMS

Correct manifest finalisation logic: set the 'finalised' flag in
rhizome_manifest_validate(), not in rhizome_manifest_verify() (which
sets 'selfSigned'), and consistently clear 'finalised' flag in all
attribute setter functions

Remove manifest 'ttl' field and all references thereof (leaving unused
space in Rhizome BAR)

Rename some payload functions for clarity
2013-12-21 14:37:18 +10:30
Andrew Bettison
273c5f2689 Make rhizome_manifest_pack_variables() static 2013-12-20 11:29:26 +10:30
Andrew Bettison
8a1ce7f373 Use manifest 'has_id' consistently 2013-12-20 11:29:26 +10:30
Andrew Bettison
d7b926c39c HTTP server response codes 408, 409 2013-12-20 11:29:26 +10:30
Andrew Bettison
d52ba4c871 Remove rhizome_read_manifest_file()
Replace with memcpy() followed by rhizome_manifest_parse()
for memory buffers

Replace with rhizome_read_manifest_from_file() for files
2013-12-20 11:29:17 +10:30
Andrew Bettison
135df30b1b Improve test framework: assertGrep --ignore-case 2013-12-19 19:14:52 +10:30
Andrew Bettison
21328e2888 Improve read_whole_file()
Move into os.c, declare and document in os.h
2013-12-19 19:14:52 +10:30
Andrew Bettison
39b2f3a6f5 Improve 'rhizomehttp' test descriptions 2013-12-19 11:29:28 +10:30
Andrew Bettison
b5f7a088b2 Fix rhizome_fill_manifest() 'name' semantics
Only set 'name' field if the given pathname is valid

Do not set 'name' field if no pathname supplied
2013-12-18 18:02:46 +10:30
Andrew Bettison
3b5c0d2092 More Rhizome external blob debug 2013-12-18 17:44:16 +10:30
Andrew Bettison
9b1ad664e9 Log error in "rhizome extract" if payload fails 2013-12-18 17:44:16 +10:30
Andrew Bettison
f5b757c022 Remove some unconditional debug from HTTP server 2013-12-18 17:44:16 +10:30
Andrew Bettison
250309f4d8 Fix strn_to_sid_t(), add strn_to_rhizome_bk_t()
Improve strn_to_rhizome_bid_t() and strn_to_rhizome_filehash_t() to
accept a NULL first arg -- useful for data validation
2013-12-18 17:44:16 +10:30
Jeremy Lakeman
8d80cf55f2 Fix printf formats 2013-12-16 15:19:15 +10:30
Andrew Bettison
6798e943ec Implement HTTP GET /restful/rhizome/<BID>/decrypted.bin 2013-12-16 15:09:46 +10:30
Andrew Bettison
f3c88def41 Refactor HTTP server result code handling
Rhizome dispatch functions now simply return the HTTP result code, or 1
if they have initiated the response themselves.
2013-12-16 15:09:46 +10:30
Andrew Bettison
8c9ac6c1a5 Improve test case for /restful/rhizome/<BID>/raw.bin
Include some encrypted payloads in the test
2013-12-13 17:41:26 +10:30
Andrew Bettison
b53cabaae5 Unify output manifest fields from CLI rhizome commands 2013-12-13 17:24:59 +10:30
Andrew Bettison
6361bfd757 Implement HTTP GET /restful/rhizome/<BID>/raw.bin 2013-12-13 16:36:37 +10:30
Andrew Bettison
183cb46000 Add Rhizome HTTP response headers to /restful/rhizome/<BID>.rhm 2013-12-13 14:49:55 +10:30
Andrew Bettison
98a6fc55d9 HTTP server support for extra response headers 2013-12-13 14:49:40 +10:30
Andrew Bettison
dd1e9f2ffb Improve HTTP server string reservation
So that reserved strings can be released, reclaiming buffer space for
responses and for response header strings
2013-12-12 17:49:19 +10:30
Andrew Bettison
1e96a8745d Merge branch 'development' into 'naf4' 2013-12-11 15:15:31 +10:30
Andrew Bettison
4cf97b7d41 Do not generate COPYRIGHT.txt in normal build
Only when making the "copyright" target.  Otherwise Makefile is broken
for developers without serval-tools and Python.
2013-12-11 15:10:01 +10:30
Andrew Bettison
e921404686 Merge branch 'warnings' into 'development'
Enables more GCC warnings and modifies much code to fix them

Initial work by Petter Reinholdtsen, remaining by Andrew Bettison
2013-12-11 14:39:44 +10:30
Andrew Bettison
6e99a3be47 Fix printf format warning on Android 2013-12-11 14:35:14 +10:30
Andrew Bettison
81f641b1fe Include <limits.h> for SIZE_MAX on Android 2013-12-11 14:34:34 +10:30
Andrew Bettison
54bebb1ebd Fix -Wsign-compare warnings in tfw_createfile 2013-12-11 14:00:41 +10:30
Andrew Bettison
f087e4ddee Fix -Wsign-compare warnings in fakeradio code
Replace int with unsigned or size_t for byte counts
2013-12-11 13:59:41 +10:30
Andrew Bettison
7582f24e9c Fix -Wsign-compare warnings in NaCl code
Make loop counters unsigned
2013-12-11 13:58:51 +10:30
Andrew Bettison
075f9c7c27 Use uint64_t for Rhizome manifest version
Instead of int64_t.  Fixes some -Wsign-compare warnings.

Replace sqlite_exec_int64() with sqlite_exec_uint64().

Also store rowid as uint64_t, and use 0 not -1 to indicate
unset.
2013-12-11 11:11:34 +10:30
Andrew Bettison
608a705403 Better size arithmetic in Rhizome database cleanup code
Fixes -Wsize-compare warnings
2013-12-10 17:24:14 +10:30
Andrew Bettison
8effa869a3 Used unsigned for byte count fields in Radio Link code
Fixes -Wsign-compare warnings
2013-12-10 17:23:38 +10:30
Andrew Bettison
3f0008bb39 Eliminate unused variable 2013-12-10 17:22:50 +10:30
Andrew Bettison
4428a76379 Use ssize_t for read(2) and write(2) return value
Test for errors using == -1 not < 0, and cast to (size_t) subsequently

Fixes some -Wsign-compare warnings
2013-12-10 17:21:35 +10:30
Andrew Bettison
6254709a84 Use RHIZOME_SIZE_UNSET instead of -1 for read_state.length
This may have been a reversion to older code caused by a careless
merge, because the change to RHIZOME_SIZE_UNSET was already made
when read_state.length was changed to unsigned.

Fixes some -Wsign-compare warnings
2013-12-10 17:17:18 +10:30
Andrew Bettison
fa9ba169a3 Fix -Wsign-compare warnings in SLIP code 2013-12-10 17:10:57 +10:30
Andrew Bettison
dea46d0d8b Fix -Wsign-compare warnings in VoMP code 2013-12-10 17:09:19 +10:30
Andrew Bettison
b7528412df Use UINT64_MAX instead of -1 for Rhizome HTTP response content_length
Fixes -Wsign-compare warnings
2013-12-10 17:06:45 +10:30
Andrew Bettison
ebc3133f5c Change overlay_buffer fields from int to size_t
Fixes many -Wsign-compare warnings
2013-12-10 17:03:30 +10:30
Andrew Bettison
6cd8df74a4 Fix -Wsign-compare warnings in CLI
Make cli_printf() return void (log errors instead)

Better size_t arithmetic in outv_growbuf()
2013-12-10 16:56:23 +10:30
Andrew Bettison
4af6cf9d6a Fix -Wsign-compare warnings: use size_t or unsigned for byte counts 2013-12-10 16:52:53 +10:30
Andrew Bettison
476a538ef7 Fix -Wsign-compare warnings in keyring: unsigned cn,in,kp 2013-12-10 16:34:35 +10:30
Andrew Bettison
5d741361ea Fix -Wsign-compare warnings: make loop counters unsigned 2013-12-10 16:21:23 +10:30
Andrew Bettison
f79e6f703a Fix WHYF_perror() format string error 2013-12-10 10:38:03 +10:30
Andrew Bettison
30b2059608 Fix -Wunused-parameter warnings
New UNUSED(param) macro suppresses the warning for a specific parameter

In some cases, removed the unused parameters.  In others, used the
parameter in a DEBUGF() or assert() statement to document the intent.
2013-12-09 18:22:18 +10:30
Andrew Bettison
68555ce241 Add some Rhizome manifest DEBUG that was missing
Revealed by -Wunused-parameter
2013-12-09 18:21:32 +10:30
Andrew Bettison
85448d5612 Fix bugs in keyring revealed by -Wunused-parameter 2013-12-09 18:19:58 +10:30
Andrew Bettison
48ef87a68b Fix -Wsign-compare warning in alloca_toprint_quoted() 2013-12-09 16:33:44 +10:30