Skip to content

Commit

Permalink
Don't send empty header if don't using zip compression
Browse files Browse the repository at this point in the history
  • Loading branch information
yarroslav committed Apr 22, 2014
1 parent 425ff83 commit f436caa
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions UAS/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,18 +457,19 @@ protected function getContents($url, $timeout = 300)
$starttime = microtime(true);
// use fopen
if (ini_get('allow_url_fopen')) {
$stream_options = array(
'http' => array(
'timeout' => $timeout
)
);
if ($this->useZipDownloads) {
$stream_options['http']['header'] = "Accept-Encoding: gzip\r\n";
}
$fp = @fopen(
$url,
'rb',
false,
stream_context_create(
array(
'http' => array(
'timeout' => $timeout,
'header' => ($this->useZipDownloads ? "Accept-Encoding: gzip\r\n" : "")
)
)
)
stream_context_create($stream_options)
);
if (is_resource($fp)) {
$data = stream_get_contents($fp);
Expand Down

0 comments on commit f436caa

Please sign in to comment.