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.
This commit is contained in:
gardners 2013-08-25 16:53:26 +09:30
parent 53ce40a053
commit 0d85d60566

View File

@ -623,9 +623,7 @@ int rhizome_server_parse_http_request(rhizome_http_request *r)
/* Refuse to honour HTTP request if required (used for debugging and /* Refuse to honour HTTP request if required (used for debugging and
testing transition from HTTP to MDP) */ testing transition from HTTP to MDP) */
if (config.debug.rhizome_nohttptx) { if (rhizome_open_read(&r->read_state, id))
rhizome_server_simple_http_response(r, 404, "<html><h1>Feigning 404 because debug.rhozome_nohttptx is set.</h1></html>\r\n");
} else if (rhizome_open_read(&r->read_state, id))
rhizome_server_simple_http_response(r, 404, "<html><h1>Payload not found</h1></html>\r\n"); rhizome_server_simple_http_response(r, 404, "<html><h1>Payload not found</h1></html>\r\n");
else{ else{
if (r->read_state.length==-1){ if (r->read_state.length==-1){
@ -814,6 +812,11 @@ int rhizome_server_http_response_header(rhizome_http_request *r, int result, con
*/ */
int rhizome_server_http_send_bytes(rhizome_http_request *r) int rhizome_server_http_send_bytes(rhizome_http_request *r)
{ {
// Don't send anything if disabled for testing HTTP->MDP Rhizome failover
if (config.debug.rhizome_nohttptx) {
return 1;
}
// keep writing until we've written something or we run out of data // keep writing until we've written something or we run out of data
while(r->request_type){ while(r->request_type){