Add 'debug.rhizome_httpd' config option

This commit is contained in:
Andrew Bettison 2013-10-16 11:23:45 +10:30
parent 00cf61721d
commit 640a61cbe5
6 changed files with 15 additions and 8 deletions

View File

@ -261,6 +261,7 @@ ATOM(bool_t, slipbytestream, 0, boolean,, "")
ATOM(bool_t, packetconstruction, 0, boolean,, "")
ATOM(bool_t, rhizome, 0, boolean,, "")
ATOM(bool_t, rhizome_bind, 0, boolean,, "")
ATOM(bool_t, rhizome_httpd, 0, boolean,, "")
ATOM(bool_t, rhizome_tx, 0, boolean,, "")
ATOM(bool_t, rhizome_rx, 0, boolean,, "")
ATOM(bool_t, rhizome_ads, 0, boolean,, "")

View File

@ -600,12 +600,12 @@ int rhizome_direct_parse_http_request(rhizome_http_request *r)
}
}
if (content == NULL) {
if (config.debug.rhizome_tx)
if (config.debug.rhizome_httpd)
DEBUGF("Received malformed HTTP request %s", alloca_toprint(160, (const char *)r->request, r->request_length));
return rhizome_server_simple_http_response(r, 400, "<html><h1>Malformed request</h1></html>\r\n");
}
INFOF("RHIZOME HTTP SERVER, %s %s %s", verb, alloca_toprint(-1, path, pathlen), proto);
if (config.debug.rhizome_tx)
if (config.debug.rhizome_httpd)
DEBUGF("headers %s", alloca_toprint(-1, headers, headerlen));
if (strcmp(verb, "POST") == 0
&& ( strcmp(path, "/rhizome/import") == 0

View File

@ -100,7 +100,7 @@ int rhizome_http_server_start(int (*parse_func)(rhizome_http_request *),
if (now < rhizome_server_last_start_attempt + 5000)
return 2;
rhizome_server_last_start_attempt = now;
if (config.debug.rhizome_tx)
if (config.debug.rhizome_httpd)
DEBUGF("Starting rhizome HTTP server");
uint16_t port;
@ -245,8 +245,8 @@ void rhizome_client_poll(struct sched_ent *alarm)
return;
}
if (sigPipeFlag) {
if (config.debug.rhizome_tx)
DEBUG("Received SIGPIPE, closing connection");
if (config.debug.rhizome_httpd)
DEBUG("Received SIGPIPE, closing HTTP connection");
rhizome_server_free_http_request(r);
return;
}
@ -595,7 +595,7 @@ int rhizome_server_parse_http_request(rhizome_http_request *r)
}
if (!path) {
if (config.debug.rhizome_tx)
if (config.debug.rhizome_httpd)
DEBUGF("Received malformed HTTP request: %s", alloca_toprint(120, (const char *)r->request, r->request_length));
rhizome_server_simple_http_response(r, 400, "<html><h1>Malformed request</h1></html>\r\n");
return 0;
@ -696,7 +696,7 @@ int rhizome_server_set_response(rhizome_http_request *r, const struct http_respo
r->buffer_length+=h->content_length;
}
r->buffer_offset = 0;
if (config.debug.rhizome_tx)
if (config.debug.rhizome_httpd)
DEBUGF("Sending HTTP response: %s", alloca_toprint(160, (const char *)r->buffer, r->buffer_length));
return 0;
}
@ -774,7 +774,7 @@ int rhizome_server_http_send_bytes(rhizome_http_request *r)
// once we've written the whole buffer, and nothing new has been generated, close the connection
if (!r->buffer_length){
if (config.debug.rhizome_tx)
if (config.debug.rhizome_httpd)
DEBUG("Closing connection, done");
return rhizome_server_free_http_request(r);
}

View File

@ -40,6 +40,7 @@ configure_servald_server() {
set log.show_pid on \
set log.show_time on \
set debug.rhizome on \
set debug.rhizome_httpd on \
set debug.rhizome_tx on \
set debug.rhizome_rx on \
set server.respawn_on_crash off \

View File

@ -41,6 +41,7 @@ configure_servald_server() {
set log.console.show_pid on \
set log.console.show_time on \
set debug.rhizome on \
set debug.rhizome_httpd on \
set debug.rhizome_tx on \
set debug.rhizome_rx on \
set server.respawn_on_crash off \
@ -216,6 +217,7 @@ start_radio_instance() {
executeOk_servald config \
set debug.rhizome on \
set debug.rhizome_ads on \
set debug.rhizome_httpd on \
set debug.rhizome_tx on \
set debug.rhizome_rx on \
set debug.throttling on \
@ -627,6 +629,7 @@ setup_direct() {
set log.console.level debug \
set log.console.show_time on \
set debug.rhizome on \
set debug.rhizome_httpd on \
set debug.rhizome_tx on \
set debug.rhizome_rx on
rhizome_add_file fileB1 2000

View File

@ -40,6 +40,7 @@ configure_servald_server() {
set log.file.show_pid on \
set log.file.show_time on \
set debug.rhizome off \
set debug.rhizome_httpd off \
set debug.rhizome_tx off \
set debug.rhizome_rx off \
set server.respawn_on_crash off \
@ -147,6 +148,7 @@ setup_StressRhizomeDirect() {
executeOk_servald config \
set log.file.show_time on \
set debug.rhizome off \
set debug.rhizome_httpd off \
set debug.rhizome_tx off \
set debug.rhizome_rx off \
set server.respawn_on_crash off \