From c586e77749ec8b3c3374d78f8b82cd7508bca868 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 31 Aug 2016 14:54:13 +0200 Subject: [PATCH] fix holiday handling to "understand" gzip compression, even if it was never requested --- calendar/inc/class.calendar_holidays.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/calendar/inc/class.calendar_holidays.inc.php b/calendar/inc/class.calendar_holidays.inc.php index f63862f08c..4aff73f1ee 100644 --- a/calendar/inc/class.calendar_holidays.inc.php +++ b/calendar/inc/class.calendar_holidays.inc.php @@ -163,6 +163,16 @@ class calendar_holidays error_log("Can NOT open holiday iCal '$url' for country '$country'!"); return array(); } + // php does not automatic gzip decode, but it does not accept that in request headers + // iCloud eg. always gzip compresses: https://p16-calendars.icloud.com/holidays/au_en-au.ics + foreach($http_response_header as $h) + { + if (preg_match('/^content-encoding:.*gzip/i', $h)) + { + stream_filter_append($f, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15|16)); + break; + } + } $parser = new calendar_ical(); if (!($icals = $parser->icaltoegw($f))) {