diff --git a/zefie_wtvp_minisrv/app.js b/zefie_wtvp_minisrv/app.js index 8b8f38be..84410fb0 100644 --- a/zefie_wtvp_minisrv/app.js +++ b/zefie_wtvp_minisrv/app.js @@ -1071,16 +1071,14 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq socket_sessions[socket.id].post_data = ""; socket_sessions[socket.id].headers = headers; var post_string = "POST"; - if (socket_sessions[socket.id].secure) { - // decrypt if encrypted - post_string = "Encrypted " + post_string; - data_hex = CryptoJS.lib.WordArray.create(socket_sessions[socket.id].wtvsec.Decrypt(0, CryptoJS.enc.Hex.parse(data_hex))).toString(CryptoJS.enc.Hex); - } - // the client may have just sent the data with the primary headers, so lets look for that. if (data_hex.indexOf("0d0a0d0a") != -1) socket_sessions[socket.id].post_data = data_hex.substring(data_hex.indexOf("0d0a0d0a") + 8); if (data_hex.indexOf("0a0a") != -1) socket_sessions[socket.id].post_data = data_hex.substring(data_hex.indexOf("0a0a") + 4); - + if (socket_sessions[socket.id].secure) { + // decrypt if encrypted + post_string = "Encrypted " + post_string; + socket_sessions[socket.id].post_data = CryptoJS.lib.WordArray.create(socket_sessions[socket.id].wtvsec.Decrypt(0, CryptoJS.enc.Hex.parse(socket_sessions[socket.id].post_data))).toString(CryptoJS.enc.Hex); + } } if (socket_sessions[socket.id].post_data.length == (socket_sessions[socket.id].post_data_length * 2)) {