From 2f7ccc66440186e29ad277a185f8d1ab57f54866 Mon Sep 17 00:00:00 2001 From: defacer Date: Sun, 25 Feb 2007 01:35:32 +0000 Subject: [PATCH] Merged from MOODLE_18_STABLE: Fix for MDL-8653: When updating languages through a proxy, skip to the end of the HTTP headers as defined by RFC 1945 instead of skipping exactly 12 lines of chaff. Credit for patch 100% to Dan Poltawski. --- admin/langimport.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/admin/langimport.php b/admin/langimport.php index 79e99deadb..93835f70fa 100755 --- a/admin/langimport.php +++ b/admin/langimport.php @@ -368,13 +368,16 @@ return false; //failed } fputs($proxy_fp, "GET $url HTTP/1.0\r\nHost: $CFG->proxyhost\r\n\r\n"); - $i = 0; - while(!feof($proxy_fp)) { + + $headers_done = false; + while(!feof($proxy_fp)) { $string = fgets($proxy_fp, 1024); - if ($i > 11) { //12 lines of info skipped + if(!$headers_done){ + // A new line indicates end of HTTP headers + $headers_done = ("\r\n" == $string); + } else { $availablelangs[] = split(',', $string); } - $i++; } fclose($proxy_fp); -- 2.39.5