Commit Graph

1157 Commits

Author SHA1 Message Date
Andrew Bettison
9d69a3c2bd Add new 'rhizomeprotocol' test case
Replacing a bundle with an empty payload, "unsharing" in UI terms
2012-07-16 18:40:30 +09:30
Andrew Bettison
d59378961c Improve rhizome test defs
Handle manifests with empty payloads:
 - assert_manifest_complete() asserts for a filehash field if the
   filesize is non zero, otherwise asserts for NO filehash field
 - assert_stdout_add_file() ditto
 - unpack_manifest_for_grep() allows an empty name if payload also empty

create_rhizome_identities() sets SID and SID{I} vars

assert_rhizome_list() dumps stderr if any assert fails
2012-07-16 18:40:30 +09:30
Andrew Bettison
61bfb7bbbc Improve 'rhizomeops' test for empty payload 2012-07-16 18:40:30 +09:30
Andrew Bettison
801a0fb7b0 Improve test framework: --filter by test numbers 2012-07-16 18:40:30 +09:30
Andrew Bettison
e67d09cf11 Fix bug in test framework output 2012-07-16 18:40:30 +09:30
gardners
636574d1cf towards DNA helper application. 2012-07-16 17:05:13 +09:30
gardners
5824c38a28 added simple random input tester for packet visualisation.
Need to supplement it with a better fuzz tester.
2012-07-16 16:28:07 +09:30
gardners
7c5c6b0826 work towards DNA helper interface. 2012-07-16 13:00:55 +09:30
gardners
71eb3de446 minor work towards DNA helper working. 2012-07-16 12:47:04 +09:30
gardners
47dbb8cee5 fixed bug when fork()ing to start DNA helper.
added some debugging.
2012-07-16 12:47:04 +09:30
Andrew Bettison
c791ba94d0 Refactor HTTP response parsing
Remove need to nul-terminate the received buffers in HTTP fetch reply handling
and HTTP server request parsing.

Remove redundant copying of data.

More rigorous parsing code, probably less vulnerable to overrun exploits.

Better debug logging of requests and responses.
2012-07-13 18:06:55 +09:30
Andrew Bettison
0c260a966e Small improvement in toprint() 2012-07-13 18:00:25 +09:30
Jeremy Lakeman
c09582a220 Transfer should work for small files that arrive with the headers 2012-07-13 13:44:05 +09:30
Andrew Bettison
1fe59edcc6 Control logging from fdqueue.c with DEBUG_IO 2012-07-13 12:51:27 +09:30
Andrew Bettison
dd225bbb7f Refactor rhizome HTTP response headers 2012-07-13 12:31:10 +09:30
Andrew Bettison
41f3228300 Refactor rhizome HTTP request parsing
Replace DEBUG_RHIZOMESYNC with DEBUG_RHIZOME_TX
2012-07-13 11:06:10 +09:30
Andrew Bettison
dcf7209304 Add read_nonblock() function
Deal with platforms where EWOULDBLOCK != EAGAIN
2012-07-13 11:04:50 +09:30
Andrew Bettison
e378a8dc82 Improve logging from rhizome HTTP server 2012-07-12 16:42:41 +09:30
Andrew Bettison
49ee4d13f0 Re-write manifest parsing, improve rhizome_fetch.c logging
Rhizome manifest parser now parses and validates all known fields, informs
about unsupported fields, and unpacks fields into relevant struct manifest
elements where appropriate.  Is also stricter about whitespace.

Rhizome fetch code now logs debug messages if DEBUG_RHIZOME_RX bit is on.
2012-07-12 16:39:01 +09:30
Andrew Bettison
025ccad810 Replace DEBUG_DNAVARS with DEBUG_RHIZOME_RX
Delete some obsolete HLR code
Mark DEBUG_HLR as deprecated
2012-07-12 16:26:37 +09:30
Andrew Bettison
208a95a233 Replace validateSid() with str_is_subscriber_id() 2012-07-12 16:14:25 +09:30
Andrew Bettison
d111f763c7 Fix bugs revealed by 'rhizomeprotocol' test
Was not transmitting actual HTTP server port in rhizome announcements, was
always transmitting port 4110.

When trying for a free HTTP server port, sometimes bind() succeeds but listen()
fails with EADDRINUSE, so new logic to deal with that.
2012-07-12 12:10:59 +09:30
Andrew Bettison
e69abc3198 Add 'rhizomeprotocol' multi-transfer test 2012-07-11 17:42:30 +09:30
Andrew Bettison
bdd0bb357f Improve logging config options
Rename config option "logfile" to "log.file"
Add "log.show_pid" boolean
Add "log.show_time" boolean
2012-07-11 17:09:50 +09:30
Andrew Bettison
f50da147d6 Fix log.c: open_logging() sets log_pid and log_time vars 2012-07-11 16:59:08 +09:30
Andrew Bettison
ff2c98afb3 Add "rhizome.fetch_interval_ms" config option 2012-07-11 16:51:30 +09:30
Andrew Bettison
218e7883ce Improve test scripts: use new 'wait_until' primitive 2012-07-11 16:51:29 +09:30
Andrew Bettison
cc39a02443 Improve test framework
Add 'wait_until' primitive
Improve option parsing
2012-07-11 16:51:29 +09:30
Jeremy Lakeman
51d66f5d9e Fix compilation for android 2012-07-11 16:05:03 +09:30
Andrew Bettison
38a5717789 Fix 'rhizomeprotocol' test to always PASS 2012-07-11 14:51:25 +09:30
Andrew Bettison
6b1becd328 Fix bug in 'rhizomeprotocol' test
Now it passes about 30% of the time!
2012-07-11 14:22:55 +09:30
Andrew Bettison
4eb3910dc1 Fix bug in Rhizome fetch - byte order of sin_port
Also improve some debug logging
2012-07-11 14:21:49 +09:30
Andrew Bettison
6556637251 Add HH:MM:SS.mmm timestamp to non-Android log entries 2012-07-11 14:18:36 +09:30
Andrew Bettison
a15a9146c3 Improve toprint() and alloca_toprint() 2012-07-11 14:17:53 +09:30
Andrew Bettison
9eeaeb9dab DEBUG_IO logging for all poll() invocations 2012-07-11 14:15:02 +09:30
Andrew Bettison
c7488de510 Add strbuf_helpers.[ch]
Functions to help assemble strbuf contents.
2012-07-11 14:11:59 +09:30
Andrew Bettison
63d1792863 Fix bugs in strbuf_ncat(), strbuf_puts() and strbuf_putc()
Were not advancing the 'current' pointer the entire length of the appended text
2012-07-11 11:41:15 +09:30
Andrew Bettison
69ff860b4f Add rhizome sync logging to 'rhizomeprotocol' test 2012-07-10 20:00:20 +09:30
Andrew Bettison
42744da371 Improve log diagnostics related to rhizome HTTP 2012-07-10 19:59:46 +09:30
Andrew Bettison
e8eab5b27e Improve diagnostics from write_all(), write_nonblock() etc.
Add toprint() function and alloca_toprint() macro.
2012-07-10 19:57:56 +09:30
Andrew Bettison
2c1c44c4fe Add strbuf_trunc() primitive, fix bug in strbuf_substr() 2012-07-10 19:36:25 +09:30
Andrew Bettison
7c2090e61c Improve error reports for write_str() etc.
Now write_str(), write_nonblock(), write_all(), set_nonblock() etc. report the
file/line/function of their caller, rather than the function in net.c.  Done
using macros, similar in style to WHY() etc.
2012-07-10 18:51:41 +09:30
Andrew Bettison
86eb482ed9 Replace macros with functions
SET_NONBLOCKING(), SET_BLOCKING(), WRITE_STR() are now set_nonblock(),
set_block() and write_str() respectively, all of which log an error before
returning -1.  There are other useful methods: write_all() treats anything less
than all bytes written as an error; write_nonblock() treats EAGAIN and EINTR as
zero bytes written, and a combination: write_all_nonblock().
2012-07-10 16:33:39 +09:30
Andrew Bettison
2758af36ee Silence strict-aliasing warnings 2012-07-10 14:33:14 +09:30
Jeremy Lakeman
624be364bf fix android log spam 2012-07-10 14:33:07 +09:30
Andrew Bettison
aa29e1ad8c First cut of 'rhizomeprotocol' tests
Currently fails because it looks like HTTP request is failing
2012-07-06 14:39:25 +09:30
Andrew Bettison
572fa591e2 Refactor test utilities from 'rhizomeops' into testdefs_rhizome.sh 2012-07-06 13:32:21 +09:30
Andrew Bettison
438cdd8b47 Rename 'rhizome' test to 'rhizomeops' 2012-07-06 13:20:37 +09:30
Andrew Bettison
17733c631c Improve test framework: clearer log messages 2012-07-06 13:18:43 +09:30
Andrew Bettison
d2898ee22c Add output fields to 'keyring add' command 2012-07-06 13:17:53 +09:30