fix encryption errors

This commit is contained in:
Eric MacDonald
2021-08-09 01:51:36 -04:00
committed by zefie
parent 410ce9f95e
commit 56ab5228cd

View File

@@ -761,16 +761,8 @@ async function sendToClient(socket, headers_obj, data) {
}
// if box can do compression, see if its worth enabling
<<<<<<< HEAD
var compression_type = shouldWeCompress(socket.ssid, headers_obj);
if (headers_obj["wtv-modern-content-type"]) delete headers_obj["wtv-modern-content-type"];
=======
if (ssid_sessions[socket.ssid].capabilities) {
if (ssid_sessions[socket.ssid].capabilities['client-can-receive-compressed-data'] && minisrv_config.config.enable_lzpf_compression) {
compress_data = shouldWeCompress(headers_obj);
}
}
>>>>>>> 6a39cc5... Scratch that. Do what offers better compression over replicating the service. RC4 is too random
// compress if needed
if (compression_type > 0 && content_length > 0 && headers_obj['http_response'].substring(0,3) == "200") {
@@ -817,17 +809,6 @@ async function sendToClient(socket, headers_obj, data) {
}
}
// encrypt if needed
if (socket_sessions[socket.id].secure == true) {
headers_obj["wtv-encrypted"] = 'true';
headers_obj = moveObjectElement('wtv-encrypted', 'Connection', headers_obj);
if (clen > 0 && socket_sessions[socket.id].wtvsec) {
if (!zquiet) console.log(" * Encrypting response to client ...")
var enc_data = socket_sessions[socket.id].wtvsec.Encrypt(1, data);
data = enc_data;
}
}
// calculate content length
// make sure we are using our Content-length and not one set in a script.
if (headers_obj["Content-Length"]) delete headers_obj["Content-Length"];