Adding new HTTP server for dlna

This commit is contained in:
Rob Emery 2025-01-03 00:31:30 +00:00
parent 1a90ce1748
commit 6c6afd544b

View File

@ -114,6 +114,9 @@ func (s *DLNAServer) Run(ctx context.Context, addr string, port int, tlsCert str
go func() {
s.ssdp.startSSDP()
}()
go func() {
s.ssdp.serveHTTP()
}()
return nil
}
@ -324,6 +327,19 @@ func (s *SSDPServer) soapActionResponse(sa upnp.SoapAction, actionRequestXML []b
return service.Handle(sa.Action, actionRequestXML, r)
}
func (s *SSDPServer) serveHTTP() error {
srv := &http.Server{
Handler: s.handler,
}
err := srv.Serve(s.HTTPConn)
select {
case <-s.waitChan:
return nil
default:
return err
}
}
func didlLite(chardata string) string {
return `<DIDL-Lite` +
` xmlns:dc="http://purl.org/dc/elements/1.1/"` +