From 063bcc9893c7d096eb92b1bc4aea6021a07044a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kadlec?= Date: Tue, 19 Apr 2016 08:13:53 +0200 Subject: [PATCH 1/2] Remove unsafe header "Connection" --- src/l10nNetteTranslator/Templates/panel.phtml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/l10nNetteTranslator/Templates/panel.phtml b/src/l10nNetteTranslator/Templates/panel.phtml index aec2de3..1246106 100644 --- a/src/l10nNetteTranslator/Templates/panel.phtml +++ b/src/l10nNetteTranslator/Templates/panel.phtml @@ -232,7 +232,6 @@ request.open("POST", '', true); request.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - request.setRequestHeader('Connection', 'close'); request.send(this.buildParams({'': data})); }, getById: function (id) { From d95a86ef941e94db4d582d8472d5ab9445220ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kadlec?= Date: Tue, 19 Apr 2016 08:56:12 +0200 Subject: [PATCH 2/2] Changed successful code from 200 to 2xx --- src/l10nNetteTranslator/Templates/panel.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/l10nNetteTranslator/Templates/panel.phtml b/src/l10nNetteTranslator/Templates/panel.phtml index 1246106..cb3df13 100644 --- a/src/l10nNetteTranslator/Templates/panel.phtml +++ b/src/l10nNetteTranslator/Templates/panel.phtml @@ -206,7 +206,7 @@ var request = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); request.onreadystatechange = function () { if (request.readyState == 4) { - if (request.status == 200) { + if (request.status.toString().match(/2\d\d/)) { var response = JSON.parse(request.responseText), key; if (response.hasOwnProperty('message') && response.message) {