Commit Graph

1147 Commits

Author SHA1 Message Date
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
Andrew Bettison
735d9a42cc Clean up compile warnings and fix bugs
In monitor_process_command() for "call" command, was not handling SID "*" case
properly, nor checking validity of hex SID.
2012-07-06 10:14:39 +09:30
Jeremy Lakeman
07c507017a Fix audio stuffing test so it doesn't repeat the same payload 2012-07-05 16:36:11 +09:30
Jeremy Lakeman
de8da93e7b Fix android build process 2012-07-05 16:09:50 +09:30
Jeremy Lakeman
7b8e82baea Refactor vomp call processing to reduce latency 2012-07-05 16:09:33 +09:30
Jeremy Lakeman
ef8c1dd981 Simplify next interface tick calculation 2012-07-05 15:56:42 +09:30
Andrew Bettison
a80da50636 Finish rewriting configuration and logging code
Fix endless recursion if error or debug logged while reading config file
Fix 'config del' logic
Log messages made before log file can be opened are buffered and written
once the file is open
Do not log to file in ANDROID version, just to Android's log system
2012-07-05 14:59:50 +09:30
Andrew Bettison
bbdfda2ce4 Improve strbuf API
Add STRUCT_STRBUF_EMPTY initialisation constant
Add strbuf_is_empty() primitive
Fix documentation comments in strbuf.h
2012-07-05 14:58:28 +09:30
Andrew Bettison
8cdae125e7 Fix 'dnaprotocol' tests broken by earlier refactor 2012-07-05 14:57:28 +09:30
Andrew Bettison
ab64b08ceb Rewrite config file code
Gets rid of rotor in confValueGet() and duplicate config file parsing code
Currently fails three tests
2012-07-04 18:57:02 +09:30
Andrew Bettison
7eb4293491 Improve test framework: receive TFW_LOGDIR env var
Always place test logs in servald build root, regardless of current
working directory
2012-07-04 14:54:37 +09:30