rebroadcast: fix basic auth

This commit is contained in:
Koushik Dutta
2025-01-07 18:50:24 -08:00
parent f8a8ed4241
commit d272a4b86f
3 changed files with 6 additions and 5 deletions

View File

@@ -395,7 +395,7 @@ export class RtspClient extends RtspBase {
hasGetParameter = true;
contentBase: string;
constructor(public url: string) {
constructor(public readonly url: string) {
super();
const u = new URL(url);
const port = parseInt(u.port) || 554;
@@ -650,7 +650,8 @@ export class RtspClient extends RtspBase {
const { parseHTTPHeadersQuotedKeyValueSet } = await import('http-auth-utils/dist/utils');
if (this.wwwAuthenticate.includes('Basic')) {
const hash = BASIC.computeHash(url);
const parsedUrl = new URL(this.url);
const hash = BASIC.computeHash({ username: parsedUrl.username, password: parsedUrl.password });
return `Basic ${hash}`;
}