Skip to content
This repository has been archived by the owner on Dec 5, 2017. It is now read-only.

Commit

Permalink
Merge pull request #29 from geecu/purge_domain
Browse files Browse the repository at this point in the history
Add the domain as 'Host:' header
  • Loading branch information
dbu committed Mar 27, 2013
2 parents 6140156 + 60fba63 commit f9cab11
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Helper/Varnish.php
Expand Up @@ -120,10 +120,19 @@ protected function sendRequestToAllVarnishes($request, array $options = array())

$curlHandler = curl_init($this->domain);

foreach ($options as $option => $value) {
$headers = array(
sprintf('Host: %s', $this->domain)
);
if (isset($options[CURLOPT_HTTPHEADER])) {
$options[CURLOPT_HTTPHEADER] = array_merge($headers, $options[CURLOPT_HTTPHEADER]);
} else {
$options[CURLOPT_HTTPHEADER] = $headers;
}

foreach ($options as $option => $value) {
curl_setopt($curlHandler, (int) $option, $value);
}

//Default Options
curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curlHandler, CURLOPT_HEADER, true); // Display headers
Expand Down

0 comments on commit f9cab11

Please sign in to comment.