summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2026-04-13 17:01:47 -0400
committerAndrew Opalach <andrew@akon.city> 2026-04-13 17:01:47 -0400
commit77b54c35bf9587450cd636e0d7df37e190e28bfb (patch)
treea290efdd8b09066847199f3f52a32be70d24ef51 /src/server
parent20617b9c80cf8d8051ecdb53a2c22f68c012f21b (diff)
downloadcamu-77b54c35bf9587450cd636e0d7df37e190e28bfb.tar.gz
camu-77b54c35bf9587450cd636e0d7df37e190e28bfb.tar.bz2
camu-77b54c35bf9587450cd636e0d7df37e190e28bfb.zip
Smaller stuff that went uncommitted
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/server')
-rw-r--r--src/server/common.h22
-rw-r--r--src/server/server.c8
2 files changed, 19 insertions, 11 deletions
diff --git a/src/server/common.h b/src/server/common.h
index 814b557..82d5f3d 100644
--- a/src/server/common.h
+++ b/src/server/common.h
@@ -3,15 +3,19 @@
#include <al/str.h>
#define CAMU_PORT 14356
-#define CAMU_MULTIPLEX_RPC 0x53
-#define CAMU_MULTIPLEX_LIANA 0x85
+#define CAMU_MULTIPLEX_RPC 0x53
+#define CAMU_MULTIPLEX_CONTROL 0x17
+#define CAMU_MULTIPLEX_LIANA 0x85
-AL_STATIC_ASSERT(rpc_not_head, CAMU_MULTIPLEX_RPC, !=, 0x48); // HEAD
-AL_STATIC_ASSERT(rpc_not_get, CAMU_MULTIPLEX_RPC, !=, 0x47); // GET
-AL_STATIC_ASSERT(rpc_not_post, CAMU_MULTIPLEX_RPC, !=, 0x50); // POST
-AL_STATIC_ASSERT(liana_not_head, CAMU_MULTIPLEX_LIANA, !=, 0x48);
-AL_STATIC_ASSERT(liana_not_get, CAMU_MULTIPLEX_LIANA, !=, 0x47);
-AL_STATIC_ASSERT(liana_not_post, CAMU_MULTIPLEX_LIANA, !=, 0x50);
+AL_STATIC_ASSERT(rpc_not_head, CAMU_MULTIPLEX_RPC, !=, 0x48); // HEAD
+AL_STATIC_ASSERT(rpc_not_get, CAMU_MULTIPLEX_RPC, !=, 0x47); // GET
+AL_STATIC_ASSERT(rpc_not_post, CAMU_MULTIPLEX_RPC, !=, 0x50); // POST
+AL_STATIC_ASSERT(control_not_head, CAMU_MULTIPLEX_CONTROL, !=, 0x48);
+AL_STATIC_ASSERT(control_not_get, CAMU_MULTIPLEX_CONTROL, !=, 0x47);
+AL_STATIC_ASSERT(control_not_post, CAMU_MULTIPLEX_CONTROL, !=, 0x50);
+AL_STATIC_ASSERT(liana_not_head, CAMU_MULTIPLEX_LIANA, !=, 0x48);
+AL_STATIC_ASSERT(liana_not_get, CAMU_MULTIPLEX_LIANA, !=, 0x47);
+AL_STATIC_ASSERT(liana_not_post, CAMU_MULTIPLEX_LIANA, !=, 0x50);
//#define CAMU_DIRECT_MODE
@@ -46,7 +50,7 @@ enum {
CAMU_LIST_END
};
-static inline bool camu_is_url(str *s, u32 i)
+static inline bool camu_is_http_url(str *s, u32 i)
{
return (al_str_cmp(s, &al_str_c("https://"), i, 8) == 0) ||
(al_str_cmp(s, &al_str_c("http://"), i, 7) == 0);
diff --git a/src/server/server.c b/src/server/server.c
index 59a0f7a..41633d2 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -350,6 +350,7 @@ static bool prepare_server_resource(struct camu_server *server, struct camu_reso
{
struct cch_entry *entry = NULL;
switch (resource->type) {
+#ifdef CACHE_HAVE_FILE
case CAMU_RESOURCE_FILE:
entry = cch_handler_file_create(&resource->uri, &al_str_c("codec"));
if (!entry) {
@@ -358,6 +359,7 @@ static bool prepare_server_resource(struct camu_server *server, struct camu_reso
}
resource->load = LIANA_ENTRY_PREPARED;
break;
+#endif
#ifdef NAUNET_HAS_CURL
case CAMU_RESOURCE_HTTP:
entry = cch_handler_http_create(&resource->uri, server->loop);
@@ -621,10 +623,10 @@ static void simple_search_portal_callback(void *userdata0, void *userdata1, stru
static u8 parse_resource_type(str *line)
{
#if defined CAMU_HAVE_PORTAL
- if (al_str_at(line, 0) == ';' || camu_is_url(line, 0)) {
+ if (al_str_at(line, 0) == ';' || camu_is_http_url(line, 0)) {
return CAMU_RESOURCE_SIMPLE_SEARCH;
#elif defined NAUNET_HAS_CURL
- if (camu_is_url(line, 0)) {
+ if (camu_is_http_url(line, 0)) {
return CAMU_RESOURCE_HTTP;
#else
if (0) {
@@ -846,6 +848,8 @@ static bool multiplex_callback(void *userdata, u8 id, struct nn_packet_stream *s
case CAMU_MULTIPLEX_RPC:
nn_rpc_add_stream(&server->server, stream);
break;
+ case CAMU_MULTIPLEX_CONTROL:
+ return false;
case CAMU_MULTIPLEX_LIANA:
lia_server_add_stream(&server->data.server, stream);
break;