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

Pierre Ynard linkfanel at yahoo.fr
Sat Aug 8 02:46:42 CEST 2020


Anyone with experience with TLS certificates can weigh in on this?
Rémi, perhaps? In #19807 it sounded like you cared quite a bit about
this feature.

On Thu, Jul 30, 2020, Pierre Ynard wrote:
> This follows the same approach as oldhttp, and should allow configuring
> the web interface to use HTTPS.
> 
> Fixes #19807
> 
> Untested (neither building, running, or testing with a valid TLS
> certificate), but I hope that this can still help.
> 
> 
> diff --git a/modules/lua/libs/httpd.c b/modules/lua/libs/httpd.c
> index 986f1e5..9733df9 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" );
> 
-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list