This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge pull request #29 from geecu/purge_domain

Add the domain as 'Host:' header
  • Loading branch information...
dbu committed Mar 27, 2013
2 parents 6140156 + 60fba63 commit f9cab11e9ab6130a1a96dad26996dc1104a68b2f
Showing with 10 additions and 1 deletion.
  1. +10 −1 Helper/Varnish.php
View
@@ -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

0 comments on commit f9cab11

Please sign in to comment.