From d33d026b12be0661b7fb79b13c74ebd031cab4d8 Mon Sep 17 00:00:00 2001 From: Siemenskun Date: Sun, 22 May 2022 01:46:46 +0300 Subject: Fix xml parsing error Move re-requesting logic before parsing response body, otherwise it puts HTTP headers into XML body --- classes/urlhelper.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'classes') diff --git a/classes/urlhelper.php b/classes/urlhelper.php index 83f66a810..637ad1a44 100644 --- a/classes/urlhelper.php +++ b/classes/urlhelper.php @@ -394,6 +394,11 @@ class UrlHelper { $ret = @curl_exec($ch); + if (curl_errno($ch) === 23 || curl_errno($ch) === 61) { + curl_setopt($ch, CURLOPT_ENCODING, 'none'); + $contents = @curl_exec($ch); + } + $headers_length = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $headers = explode("\r\n", substr($ret, 0, $headers_length)); $contents = substr($ret, $headers_length); @@ -413,11 +418,6 @@ class UrlHelper { } } - if (curl_errno($ch) === 23 || curl_errno($ch) === 61) { - curl_setopt($ch, CURLOPT_ENCODING, 'none'); - $contents = @curl_exec($ch); - } - $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); self::$fetch_last_content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); -- cgit v1.2.3 From 3406a16025883ef43f41480885c099fd0ce91c99 Mon Sep 17 00:00:00 2001 From: Siemenskun Date: Sun, 22 May 2022 02:02:56 +0300 Subject: Fix typo --- classes/urlhelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/urlhelper.php b/classes/urlhelper.php index 637ad1a44..92e7f90df 100644 --- a/classes/urlhelper.php +++ b/classes/urlhelper.php @@ -396,7 +396,7 @@ class UrlHelper { if (curl_errno($ch) === 23 || curl_errno($ch) === 61) { curl_setopt($ch, CURLOPT_ENCODING, 'none'); - $contents = @curl_exec($ch); + $ret = @curl_exec($ch); } $headers_length = curl_getinfo($ch, CURLINFO_HEADER_SIZE); -- cgit v1.2.3