Draft: httpd server implementation
Context
This is a PoC to test the feasibility of modularizing VLC’s HTTP server and integrating an external library (libmicrohttpd v2) for this purpose. Discussions regarding this are ongoing in #28934.
Key Changes
-
libmicrohttpd contrib (integrated with a patch to implement TLS using vlc_tls APIs)
This patch adds support for plugging in external TLS callbacks. We have discussed this with the MHD maintainers, and they have agreed to review the patch officially. It is currently submitted for official review. -
microhttpd module
Usesvlc_poll_i11e
in the external event loop for cancellation support. Uses chunked transfer encoding for streaming use cases. -
new vlc_httpd APIs
Addresses issues in #25000 -
vlc_httpd test
A simple curl-based test covering a few vlc_httpd_* APIs has been added. More test cases will be included once the PoC is accepted by the community.
Note: Inter-device tests (within a LAN) of http access output and Lua interface have also been conducted manually using the new APIs. The relevant modules have not yet been adapted because the legacy HTTPD has not been moved to a fallback module. Once that is done, the sout modules will be adapted to ensure compatibility with contrib-less builds.
Future Work
- Address external TLS patch reviews (after the official review by MHD) and upstream the patch.
- Implement a thread pool (based on community feedback).
- Move the legacy HTTPD implementation to a minimal fallback module.
- Adapt sout modules to use the new vlc_httpd_* APIs.
- Add more test cases in the vlc_httpd test.
- Implement WebSocket support.
- Integrate the remoteaccess interface.
- Connection suspension and zero-copy data mechanism in
stream_cb
(dependent on the implementation ofMHD_DCC_action_suspend
andiov_data
inMHD_DCC_action_continue_zc
; currently blocked). - unicast streaming and filesystem access (new high-level APIs can be added, or existing APIs reworked based on requirements).