diff --git a/conf_schema.h b/conf_schema.h index dc896a7b..bed9b4f9 100644 --- a/conf_schema.h +++ b/conf_schema.h @@ -258,6 +258,7 @@ ATOM(bool_t, rhizome, 0, boolean,, "") ATOM(bool_t, rhizome_tx, 0, boolean,, "") ATOM(bool_t, rhizome_rx, 0, boolean,, "") ATOM(bool_t, rhizome_ads, 0, boolean,, "") +ATOM(bool_t, rhizome_nohttptx, 0, boolean,, "") ATOM(bool_t, meshms, 0, boolean,, "") ATOM(bool_t, manifests, 0, boolean,, "") ATOM(bool_t, vomp, 0, boolean,, "") diff --git a/rhizome_http.c b/rhizome_http.c index c38cb1c0..5f9b6ae3 100644 --- a/rhizome_http.c +++ b/rhizome_http.c @@ -620,7 +620,12 @@ int rhizome_server_parse_http_request(rhizome_http_request *r) } else { str_toupper_inplace(id); bzero(&r->read_state, sizeof(r->read_state)); - if (rhizome_open_read(&r->read_state, id)) + + /* Refuse to honour HTTP request if required (used for debugging and + testing transition from HTTP to MDP) */ + if (config.debug.rhizome_nohttptx) { + rhizome_server_simple_http_response(r, 404, "

Feigning 404 because debug.rhozome_nohttptx is set.

\r\n"); + } else if (rhizome_open_read(&r->read_state, id)) rhizome_server_simple_http_response(r, 404, "

Payload not found

\r\n"); else{ if (r->read_state.length==-1){ diff --git a/tests/rhizomeprotocol b/tests/rhizomeprotocol index 8fbec7b9..e9742dc8 100755 --- a/tests/rhizomeprotocol +++ b/tests/rhizomeprotocol @@ -182,6 +182,23 @@ test_MDPTransport() { receive_and_update_bundle } +doc_MDPTransportFailOver="Rhizome fails over to MDP transport" +setup_MDPTransportFailOver() { + setup_common + foreach_instance +A +B \ + executeOk_servald config \ + set debug.rhizome_nohttptx 1 \ + set rhizome.mdp.enable 1 + set_instance +A + rhizome_add_file file1 2048 + start_servald_instances +A +B + foreach_instance +A assert_peers_are_instances +B + foreach_instance +B assert_peers_are_instances +A +} +test_MDPTransportFailOver() { + receive_and_update_bundle +} + doc_UnicastTransfer="Rhizome over unicast MDP link" setup_UnicastTransfer() { setup_common