fix: some incoming headers were not displayed

This commit is contained in:
zefie
2024-05-30 16:39:00 -04:00
parent 5cf95e22d9
commit 8c7a6369fa
2 changed files with 5 additions and 6 deletions

View File

@@ -850,7 +850,7 @@ minisrv-no-mail-count: true`;
if ((shortURL.indexOf(":/ROMCache/") != -1 || shortURL.indexOf("://ROMCache/") != -1) && minisrv_config.config.enable_shared_romcache) { 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]); 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; socket_sessions[socket.id].request_headers = request_headers;
processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services); 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) { } 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); debug('request_headers', request_headers);
if (request_headers.request.indexOf("HTTP/1.0") > 0) { if (request_headers.request.indexOf("HTTP/1.0") > 0) {
// webtv in HTTP/1.0 mode, try to kick it back to WTVP // 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); var errpage = wtvshared.doErrorPage(500, null, null, false, true);
headers = errpage[0]; headers = errpage[0];
data = '' data = ''
@@ -880,7 +880,7 @@ minisrv-no-mail-count: true`;
sendToClient(socket, headers, data); sendToClient(socket, headers, data);
} else { } else {
// error reading headers (no request_url provided) // 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); var errpage = wtvshared.doErrorPage(400, null, null, false, true);
headers = errpage[0]; headers = errpage[0];
data = '' data = ''
@@ -977,7 +977,7 @@ async function doHTTPProxy(socket, request_headers) {
var idx = request_headers.request_url.indexOf('/') - 1; var idx = request_headers.request_url.indexOf('/') - 1;
var request_type = request_headers.request_url.substring(0, idx); 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) { switch (request_type) {
case "https": case "https":
var proxy_agent = https; var proxy_agent = https;

View File

@@ -807,8 +807,7 @@ class WTVShared {
new_obj = this.cloneObj(obj) new_obj = this.cloneObj(obj)
new_obj["wtv-client-serial-number"] = this.censorSSID(new_obj["wtv-client-serial-number"]); new_obj["wtv-client-serial-number"] = this.censorSSID(new_obj["wtv-client-serial-number"]);
} }
// Assuming cloneObj is necessary for other reasons return (new_obj != false) ? new_obj : obj;
return this.cloneObj((new_obj != false) ? new_obj : obj);
} }
} }
return obj; return obj;