From 8c7a6369fa6d664c468e002efc3b33b887e051bd Mon Sep 17 00:00:00 2001 From: zefie Date: Thu, 30 May 2024 16:39:00 -0400 Subject: [PATCH] fix: some incoming headers were not displayed --- zefie_wtvp_minisrv/app.js | 8 ++++---- zefie_wtvp_minisrv/includes/classes/WTVShared.js | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/zefie_wtvp_minisrv/app.js b/zefie_wtvp_minisrv/app.js index 0f8b3a8e..df34cd34 100644 --- a/zefie_wtvp_minisrv/app.js +++ b/zefie_wtvp_minisrv/app.js @@ -850,7 +850,7 @@ minisrv-no-mail-count: true`; if ((shortURL.indexOf(":/ROMCache/") != -1 || shortURL.indexOf("://ROMCache/") != -1) && minisrv_config.config.enable_shared_romcache) { shared_romcache = wtvshared.fixPathSlashes(minisrv_config.config.SharedROMCache + path.sep + shortURL.split(':/')[1]); } - if (minisrv_config.config.debug_flags.show_headers) console.log(" * Incoming headers on socket ID", socket.id, (await wtvshared.decodePostData(wtvshared.filterRequestLog(wtvshared.filterSSID(request_headers))))); + if (minisrv_config.config.debug_flags.show_headers) console.log(" * Incoming headers on socket ID", socket.id, (await wtvshared.decodePostData(await wtvshared.filterRequestLog(await wtvshared.filterSSID(request_headers))))); socket_sessions[socket.id].request_headers = request_headers; processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services); } else if (shortURL.indexOf('http://') >= 0 || shortURL.indexOf('https://') >= 0 || (use_external_proxy == true && shortURL.indexOf(service_name + "://") >= 0) && !pc_services) { @@ -872,7 +872,7 @@ minisrv-no-mail-count: true`; debug('request_headers', request_headers); if (request_headers.request.indexOf("HTTP/1.0") > 0) { // webtv in HTTP/1.0 mode, try to kick it back to WTVP - if (minisrv_config.config.debug_flags.show_headers) console.log(" * Incoming invalid headers on socket ID", socket.id, (await wtvshared.decodePostData(wtvshared.filterRequestLog(wtvshared.filterSSID(request_headers))))); + if (minisrv_config.config.debug_flags.show_headers) console.log(" * Incoming invalid headers on socket ID", socket.id, (await wtvshared.decodePostData(await wtvshared.filterRequestLog(await wtvshared.filterSSID(request_headers))))); var errpage = wtvshared.doErrorPage(500, null, null, false, true); headers = errpage[0]; data = '' @@ -880,7 +880,7 @@ minisrv-no-mail-count: true`; sendToClient(socket, headers, data); } else { // error reading headers (no request_url provided) - if (minisrv_config.config.debug_flags.show_headers) console.log(" * Incoming invalid headers on socket ID", socket.id, (await wtvshared.decodePostData(wtvshared.filterRequestLog(wtvshared.filterSSID(request_headers))))); + if (minisrv_config.config.debug_flags.show_headers) console.log(" * Incoming invalid headers on socket ID", socket.id, (await wtvshared.decodePostData(await wtvshared.filterRequestLog(await wtvshared.filterSSID(request_headers))))); var errpage = wtvshared.doErrorPage(400, null, null, false, true); headers = errpage[0]; data = '' @@ -977,7 +977,7 @@ async function doHTTPProxy(socket, request_headers) { var idx = request_headers.request_url.indexOf('/') - 1; var request_type = request_headers.request_url.substring(0, idx); - if (minisrv_config.config.debug_flags.show_headers) console.log(request_type.toUpperCase() + " Proxy: Client Request Headers on socket ID", socket.id, (await wtvshared.decodePostData(wtvshared.filterRequestLog(wtvshared.filterSSID(request_headers))))); + if (minisrv_config.config.debug_flags.show_headers) console.log(request_type.toUpperCase() + " Proxy: Client Request Headers on socket ID", socket.id, (await wtvshared.decodePostData(await wtvshared.filterRequestLog(await wtvshared.filterSSID(request_headers))))); switch (request_type) { case "https": var proxy_agent = https; diff --git a/zefie_wtvp_minisrv/includes/classes/WTVShared.js b/zefie_wtvp_minisrv/includes/classes/WTVShared.js index 92632972..c90022bf 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVShared.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVShared.js @@ -807,8 +807,7 @@ class WTVShared { new_obj = this.cloneObj(obj) new_obj["wtv-client-serial-number"] = this.censorSSID(new_obj["wtv-client-serial-number"]); } - // Assuming cloneObj is necessary for other reasons - return this.cloneObj((new_obj != false) ? new_obj : obj); + return (new_obj != false) ? new_obj : obj; } } return obj;