16 Commits

Author SHA1 Message Date
Christian Meffert
a2d56df416 [httpd] Fix infinite loop with more than one ws connection 2025-01-22 20:27:34 +01:00
Christian Meffert
a454f062bb [web] Implement libevent ws in httpd_libeventhttp, address thread safety 2025-01-22 20:27:34 +01:00
Christian Meffert
eca99f120a [httpd] libevent proxy handling changes with libevent >= 2.2 2025-01-22 20:27:34 +01:00
Christian Meffert
a3ab301cff [web] Support libevent as WS server instead of libwebsockets
If libevent >= 2.2 is detected during configure and "websocket_port" == 0 in the config file, the libwebsocket implementation is disabled and instead the libevent http server offers the websocket connection. The connection to the websocket is then done with the path "/ws".
2025-01-22 20:27:34 +01:00
ejurgensen
13131f43ef [httpd] Workaround evhttp_connection_get_addr() issue in libevent 2.1.6 and 8
Fixes 
2024-07-05 16:02:06 +02:00
ejurgensen
ff2d0b4ab1 [httpd] Check speaker settings to determine DAAP/RSP stream format 2024-06-17 22:25:20 +02:00
ejurgensen
c30f44fd01 [misc] New net_peer_address_is_trusted with cfg set default to "lan"
New default for "trusted_networks" = "lan". This will check peer addresses
against the addresses/netmasks of the interfaces to establish whether the peer
is local.

Fixes 
2024-06-16 01:17:11 +02:00
ejurgensen
c293f72846 [httpd] Fix for musl libc not having sys/queue.c (closes ) 2024-03-03 22:41:25 +01:00
ejurgensen
54c2667aea [misc] Use fcntl+O_NONBLOCK when binding instead of socket+SOCK_NONBLOCK
socket() with SOCK_NONBLOCK (O_NONBLOCK) seems not to be possible on MacOS, it
yields 'Protocol wrong type for socket'. Switch to using fcntl() and O_NONBLOCK
instead, hopefully works better cross-platform.

Closes 
2023-09-01 17:13:33 +02:00
ejurgensen
e94838925e [httpd] Change prototype for the close connection callback
Don't include hreq since it isn't fully valid, so caller shouldn't be invited
to dereference it.
2023-03-07 21:01:45 +01:00
ejurgensen
18a80f15dd [httpd] Multithread solution using worker threads instead of httpd threads
Using worker threads instead of httpd threads means that we, not libevent,
decide which requests get handled by which threads. This means that we can
make sure blocking requests (e.g. volume changes) don't get in the way of
realtime(ish) stuff like mp3 streaming.

Includes refactor of httpd_stream_file() since it was a bit of a monster.
2023-03-07 21:01:45 +01:00
ejurgensen
e77cb3f94e [streaming] ICY handling using output metadata events/callbacks 2023-03-07 21:01:10 +01:00
ejurgensen
4d0c297901 [evhtr] Consolidate pool threading in evthr.c
Also reinstate check for server already running
2023-03-07 21:01:10 +01:00
ejurgensen
bd6f38282c [httpd] Main commit that adds multithreading to httpd
Also refactor streaming implementation to make it more like an output and to
let the design support multithreading.
2023-03-07 21:01:10 +01:00
ejurgensen
50a319df2b [httpd] Try doing request handling in worker thread 2023-03-07 21:01:10 +01:00
ejurgensen
74f1b93b42 [httpd] Make http modules agnostic to evhttp 2023-03-07 21:01:10 +01:00