summaryrefslogtreecommitdiff
path: root/src/cache/handlers/http.c
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2026-08-26 17:56:52 -0400
committerAndrew Opalach <andrew@akon.city> 2026-08-26 17:56:52 -0400
commit197d41a3e23cab35848f623c6133baccc62aacbe (patch)
tree04943c1de9653de53615e10ced1eab07c2562325 /src/cache/handlers/http.c
parent6094c907b26e21f13373bae6bf3306dbae40af3c (diff)
downloadcamu-197d41a3e23cab35848f623c6133baccc62aacbe.tar.gz
camu-197d41a3e23cab35848f623c6133baccc62aacbe.tar.bz2
camu-197d41a3e23cab35848f623c6133baccc62aacbe.zip
OSD stuff and Android fixes
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/cache/handlers/http.c')
-rw-r--r--src/cache/handlers/http.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/cache/handlers/http.c b/src/cache/handlers/http.c
index f57d3eb..4fe82e2 100644
--- a/src/cache/handlers/http.c
+++ b/src/cache/handlers/http.c
@@ -1,10 +1,12 @@
#define AL_LOG_SECTION "cache_http"
+#define AL_LOG_ENABLE_TRACE
#include <al/log.h>
+#include <nnwt/common.h>
#include "../../codec/codec.h"
#include "../backings/memory.h"
-//#include "../backings/file.h"
+#include "../backings/file.h"
#include "../threaded_waits.h"
#include "../wait.h"
@@ -78,11 +80,14 @@ static void handler_http_maybe_spawn_worker(struct cch_handler *handler, size_t
{
struct cch_handler_http *http = (struct cch_handler_http *)handler;
(void)index;
- al_array_push(http->requests, (struct nn_http){ 0 });
- struct nn_http *request = &al_array_last(http->requests);
+ struct nn_http *request = al_alloc_object(struct nn_http);
+ al_array_push(http->requests, request);
nn_http_init(request);
nn_http_set_url(request, &http->url);
nn_http_set_user_agent(request, &USER_AGENT);
+ if (index != 0) {
+ nn_http_set_range(request, index, 0);
+ }
nn_http_request_stream(request, NNWT_HTTP_GET, http->loop, http_callback, http);
log_debug("Spawning worker for %.*s.", al_str_x(&http->url));
}
@@ -104,7 +109,7 @@ static void handler_http_free(struct cch_handler **handler)
struct cch_handler_http *http = (struct cch_handler_http *)*handler;
cch_threaded_waits_disable_all(&http->waits);
struct nn_http *request;
- al_array_foreach_ptr(http->requests, i, request) {
+ al_array_foreach(http->requests, i, request) {
nn_http_close(request);
}
cch_threaded_waits_close(&http->waits);
@@ -115,6 +120,7 @@ static void handler_http_free(struct cch_handler **handler)
*handler = NULL;
}
+
struct cch_entry *cch_handler_http_create(str *url, struct nn_event_loop *loop)
{
struct cch_backing *backing = cch_backing_memory_create(1024 * 128);