Commit Graph

121 Commits

Author SHA1 Message Date
Andrew Bettison
d5b48f5a9e Improve HTTP server generated content logic
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.
2013-11-09 11:31:21 +10:30
Andrew Bettison
1b906f3f11 Implement HTTP /restful/rhizome/bundlelist.json
Only tested for one bundle.
2013-11-07 23:40:56 +10:30
Andrew Bettison
d337542067 Improve HTTP server generated content logic
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.
2013-11-07 23:39:24 +10:30
Andrew Bettison
21fe12859f Implement HTTP basic authentication
Use it in /restful/rhizome/bundlelist.json -- first 'rhizomehttp' test
passes
2013-10-29 17:32:04 +10:30
Andrew Bettison
8f60a4ceb5 Fix bugs in new HTTP server MIME body parsing code
Fixes 'rhizomeprotocol' test 24 HttpAddLocal.  Four tests still fail.
2013-10-28 12:08:57 +10:30
Andrew Bettison
0397a47753 Fix some test failures in new HTTP server code 2013-10-26 20:28:47 +10:30
Andrew Bettison
5ff5a02bb9 Fix a couple more bugs in new HTTP server code 2013-10-25 23:57:23 +10:30
Andrew Bettison
6488f7ad65 Fix basic bugs in new HTTP server code
All 'rhizomeprotocol' HTTP tests still fail
2013-10-25 17:38:51 +10:30
Andrew Bettison
291a631095 New header file "fdqueue.h"
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"
2013-10-25 00:20:53 +10:30
Andrew Bettison
fa21bec880 Rewrite HTTP server 2013-10-25 00:19:37 +10:30
Andrew Bettison
640a61cbe5 Add 'debug.rhizome_httpd' config option 2013-10-16 11:23:45 +10:30
Andrew Bettison
00cf61721d Rename http_header_complete() to is_http_header_complete() 2013-10-16 11:22:02 +10:30
Andrew Bettison
974c7a56a0 Issue #11: Use rhizome_filehash_t everywhere 2013-10-11 15:35:27 +10:30
Andrew Bettison
a95ef79139 Use sid_t everywhere
Remove stowSid() at last

Change API of tohex() and strbuf_tohex(), to pass string length instead of
binary byte count.  This allows odd numbers of hex digits to be produced.

Remove alloca_tohex_sid(); replace with alloca_tohex_sid_t()

New alloca_tohex_sid_t_trunc() macro
2013-10-09 18:54:21 +10:30
Andrew Bettison
7a8d750a0e Issue #11: uint16_t instead of short for TCP port number 2013-10-07 23:37:37 +10:30
Andrew Bettison
ab31420faf rhizome_bid_t
Consistent type for internal binary representation of Rhizome Bundle ID
(aka Manifest ID)
2013-10-03 23:16:45 +09:30
Jeremy Lakeman
4838a529bd Don't busy wait while testing for MDP failover 2013-09-24 15:15:32 +09:30
Jeremy Lakeman
b38b4720cc Add html stats for http connection and mdp transfer counts 2013-09-24 14:34:51 +09:30
Jeremy Lakeman
9885280334 Squelch warning on success 2013-09-24 14:34:51 +09:30
Jeremy Lakeman
931ca60554 Refactor and simplify http server
- Define a function per page that is responsible for parsing requests
- Define a "generator" callback function for filling the buffer for a response
- Remove features that have never been used
- Remove functions that are no longer used
2013-09-24 14:34:50 +09:30
Jeremy Lakeman
08b44e96ed Improve html debug statistics
- shift radio rssi onto interace structure
- track packets sent received
- create html output for interface stats
- create html output for link state routing stats
2013-09-23 11:31:38 +09:30
gardners
0d85d60566 relocate point of action for debug.rhizome_nohttptx so that it
performs correctly, and can be genuinely used to test failover from
http to mdp.
this has been confirmed by running the resulting rhizomeprotocol test
before and after application of the fix for the regression that stopped
the failover from working in certain circumstances.
2013-08-25 16:53:26 +09:30
gardners
9b09021605 add test for falling over to MDP when HTTP rhizome fetching fails. 2013-08-25 16:37:44 +09:30
Jeremy Lakeman
f9b828c3dd Remove payload if hash doesn't match when reading back 2013-08-21 15:45:18 +09:30
Jeremy Lakeman
771cb4151b Fetch journal range via HTTP 2013-08-15 17:00:43 +09:30
Jeremy Lakeman
21132466f1 Serve a range of a file payload via HTTP 2013-08-15 16:31:26 +09:30
gardners
8968d5cf05 report RFD900 packets received as well as link margin estimate.
(non-zero packets received implies radio link).
2013-07-19 20:04:15 +09:30
Jeremy Lakeman
3855ff35c4 Clean up string formatting for 64bit compilation 2013-07-15 09:59:24 +09:30
Jeremy Lakeman
8ac359e550 Use consistent integer types for 64bit compilation 2013-07-13 14:47:06 +09:30
Jeremy Lakeman
a1ac7febe2 Add rhizome fetch status html page 2013-07-11 12:32:06 +09:30
Jeremy Lakeman
3e57add9ca Fix, initialise read / write handles so we don't close fd=0 2013-06-19 12:05:56 +09:30
Jeremy Lakeman
40364be92f Fix and improve rhizome stress test
- reduce dependance on routing
- fail immediately if a servald instance crashes
2013-06-18 16:33:41 +09:30
gardners
0898981807 add time stamp to rssi.csv 2013-05-07 13:40:38 +09:30
gardners
3692a959d5 add rssi.csv http request 2013-05-07 13:40:07 +09:30
Jeremy Lakeman
73786bcb5d Refactor all rhizome reading and writing
- The API in rhizome_store.c is used for all reading and writing
- external storage is now usable for all transport options
2013-02-20 16:18:59 +10:30
gardners
3301a51883 fix behaviour when rhizome http service is disabled so that
rhizomeprotocol test 3 can detect when rhizome http is disabled,
even though the http server itself runs for providing informational
services.
2013-02-20 16:18:56 +10:30
gardners
2252fdcaa7 created tool for automatically finding IN()s without matching
OUT()s or where return() is used instead of RETURN().
Added OUT() to end of all functions using IN() that lacked it to
make it easier to statically analyse this invariant.
Fixed several return instead of RETURNs detected through use of
this tool. #49
2013-02-20 16:18:56 +10:30
gardners
f681356f52 reformat /rssi web page to better fit on phone screens. 2013-02-20 15:36:31 +10:30
gardners
e551017896 push profiling down deeper into rhizome_fetch_poll()'s children. 2013-02-20 15:36:29 +10:30
gardners
60015a1aee keep HTTP server running when rhizome over http is disabled, but
don't serve and rhizome requests.
2013-02-20 15:36:29 +10:30
gardners
f114e6d19e add progress data for each rhizome transfer. 2013-02-20 15:36:28 +10:30
gardners
d49649ed96 add stored bundle count to /rssi web page display. 2013-02-20 15:36:28 +10:30
gardners
3bd4c49af5 add more info to /rssi http page. 2013-02-20 15:36:27 +10:30
gardners
d251f46638 add SID to rssi display 2013-02-20 15:36:27 +10:30
gardners
b9c924c5fe make rssi web page text really big for small phone screens. 2013-02-20 15:36:27 +10:30
gardners
66956d84ce add /rssi page to rhizome web server to allow easy querying of
radio link budget.
2013-02-20 15:36:27 +10:30
Jeremy Lakeman
340003ed99 Don't keep sql blob open from http server 2013-01-30 11:46:10 +11:00
Andrew Bettison
5985df751d Overhaul debug flags
Replace debugflags_t and DEBUG_XXX bit masks with config schema "debug.xxx"
entries.

No more support for "debug.all".
2012-12-11 15:59:46 +10:30
gardners
f827c7c1c8 fixed various problems following split of files into fileblobs 2012-12-04 16:47:45 +10:30
gardners
b91e832ad7 added improved control of rhizome http and mdp servers via
separate config options with their own predicate functions.
2012-11-30 14:47:27 +10:30