From ffeeed9b32d447679328cd11272a38e73423959b Mon Sep 17 00:00:00 2001 From: defacer Date: Sun, 25 Feb 2007 01:31:56 +0000 Subject: [PATCH] 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 79e99deadb5..93835f70fa2 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);