[vlc-commits] lua httpd: use TLS if --http-cert is set

Pierre Ynard git at videolan.org
Sat Sep 5 07:42:28 CEST 2020


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sat Sep  5 06:31:55 2020 +0200| [b33c2c3afe4535242f1cff4e555fa1131b50eb7e] | committer: Pierre Ynard

lua httpd: use TLS if --http-cert is set

This follows the same approach as oldhttp, and allows configuring the
web interface to use HTTPS.

Refs #19807

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b33c2c3afe4535242f1cff4e555fa1131b50eb7e
---

 modules/lua/libs/httpd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/lua/libs/httpd.c b/modules/lua/libs/httpd.c
index 986f1e5564..9733df9a2b 100644
--- a/modules/lua/libs/httpd.c
+++ b/modules/lua/libs/httpd.c
@@ -81,7 +81,10 @@ static const char no_password_title[] = N_("VLC media player");
 static int vlclua_httpd_tls_host_new( lua_State *L )
 {
     vlc_object_t *p_this = vlclua_get_this( L );
-    httpd_host_t *p_host = vlc_http_HostNew( p_this );
+    char *psz_cert = var_InheritString( p_this, "http-cert" );
+    httpd_host_t *p_host = psz_cert == NULL ? vlc_http_HostNew( p_this )
+                                            : vlc_https_HostNew( p_this );
+    free( psz_cert );
     if( !p_host )
         return luaL_error( L, "Failed to create HTTP host" );
 



More information about the vlc-commits mailing list