Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add the domain as 'Host:' header #29

Merged
merged 2 commits into from Mar 27, 2013
Jump to file or symbol
Failed to load files and symbols.
+10 −1
Split
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