mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-03-23 04:15:18 +00:00
Merged rhizome direct httpd back into main rhizome httpd server.
bundles can be imported via HTTP POST multi-part form. #9
This commit is contained in:
parent
f9a29645a8
commit
d3f5c6e598
@ -1783,8 +1783,6 @@ command_line_option command_line_options[]={
|
||||
"Extract a manifest from Rhizome and write it to the given path"},
|
||||
{app_rhizome_extract_file,{"rhizome","extract","file","<fileid>","[<filepath>]","[<key>]",NULL},CLIFLAG_STANDALONE,
|
||||
"Extract a file from Rhizome and write it to the given path"},
|
||||
{app_rhizome_direct_server,{"rhizome","direct","server",NULL},CLIFLAG_STANDALONE,
|
||||
"Listen for Rhizome Direct requests"},
|
||||
{app_rhizome_direct_sync,{"rhizome","direct","sync","<ip:port>",NULL},
|
||||
CLIFLAG_STANDALONE,
|
||||
"Synchronise with the specified Rhizome Direct server. Return when done."},
|
||||
|
@ -43,8 +43,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#define RHIZOME_HTTP_PORT 4110
|
||||
#define RHIZOME_HTTP_PORT_MAX 4150
|
||||
#define RHIZOME_DIRECT_PORT 4100
|
||||
#define RHIZOME_DIRECT_PORT_MAX 4109
|
||||
|
||||
extern time_ms_t rhizome_voice_timeout;
|
||||
|
||||
|
@ -564,39 +564,6 @@ int rhizome_direct_parse_http_request(rhizome_http_request *r)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_rhizome_direct_server(int argc, const char *const *argv,
|
||||
struct command_line_option *o)
|
||||
{
|
||||
/* Start Rhizome Direct server on configured port.
|
||||
We re-use the Rhizome HTTP server code as much as possible here,
|
||||
just replacing the server and client poll functions with our own.
|
||||
*/
|
||||
|
||||
int port_low=confValueGetInt64Range("rhizome.direct.port",RHIZOME_DIRECT_PORT,
|
||||
0,65535);
|
||||
int port_high=confValueGetInt64Range("rhizome.direct.port_max",RHIZOME_DIRECT_PORT_MAX,
|
||||
port_low,65535);
|
||||
|
||||
/* Rhizome direct mode doesn't need all of the normal servald preparation, because
|
||||
rhizome direct just needs to listen on its port, talk to other rhizome direct
|
||||
daemons, and query the rhizome database directly. So we probably just need to
|
||||
read configuration settings so that we can access the rhizome sqlite database.
|
||||
*/
|
||||
|
||||
/* Start rhizome direct http server */
|
||||
rhizome_http_server_start(rhizome_direct_parse_http_request,
|
||||
"rhizome_direct_parse_http_request",
|
||||
port_low,port_high);
|
||||
|
||||
/* Respond to events */
|
||||
while(1) {
|
||||
/* Check for activitiy and respond to it */
|
||||
fd_poll();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int app_rhizome_direct_sync(int argc, const char *const *argv,
|
||||
struct command_line_option *o)
|
||||
{
|
||||
|
@ -473,6 +473,7 @@ int http_header_complete(const char *buf, size_t len, size_t tail)
|
||||
return count == 2;
|
||||
}
|
||||
|
||||
int rhizome_direct_parse_http_request(rhizome_http_request *r);
|
||||
int rhizome_server_parse_http_request(rhizome_http_request *r)
|
||||
{
|
||||
/* Switching to writing, so update the call-back */
|
||||
@ -483,7 +484,9 @@ int rhizome_server_parse_http_request(rhizome_http_request *r)
|
||||
// Parse the HTTP "GET" line.
|
||||
char *path = NULL;
|
||||
size_t pathlen = 0;
|
||||
if (str_startswith(r->request, "GET ", &path)) {
|
||||
if (str_startswith(r->request, "POST ", &path)) {
|
||||
return rhizome_direct_parse_http_request(r);
|
||||
} else if (str_startswith(r->request, "GET ", &path)) {
|
||||
char *p;
|
||||
// This loop is guaranteed to terminate before the end of the buffer, because we know that the
|
||||
// buffer contains at least "\n\n" and maybe "\r\n\r\n" at the end of the header block.
|
||||
|
2
serval.h
2
serval.h
@ -1057,8 +1057,6 @@ int overlay_broadcast_ensemble(int interface_number,
|
||||
|
||||
int app_rhizome_direct_sync(int argc, const char *const *argv,
|
||||
struct command_line_option *o);
|
||||
int app_rhizome_direct_server(int argc, const char *const *argv,
|
||||
struct command_line_option *o);
|
||||
|
||||
#ifdef HAVE_VOIPTEST
|
||||
int app_pa_phone(int argc, const char *const *argv, struct command_line_option *o);
|
||||
|
Loading…
x
Reference in New Issue
Block a user