Skip to content

Commit

Permalink
lib/simplepie MDL-7946 Set magpie HTTP headers with curl
Browse files Browse the repository at this point in the history
This allows simplepie to set if-modified-since/if-none-match headers
to efficiently test if a feed has been updated without recieving the
whole content
  • Loading branch information
poltawski committed Jul 30, 2009
1 parent b378097 commit 1597e75
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/simplepie/moodle_simplepie.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ function moodle_simplepie_file($url, $timeout = 10, $redirects = 5, $headers = n
$curl = new curl();
$curl->setopt(array('CURLOPT_HEADER'=>true));

if ($headers !== null) {
// translate simplepie headers to those class curl expects
foreach($headers as $headername => $headervalue){
$headerstr = "{$headername}: {$headervalue}";
$curl->setHeader($headerstr);
}
}

$this->headers = $curl->get($url);

if ($curl->error) {
Expand Down

0 comments on commit 1597e75

Please sign in to comment.