Skip to content

Commit ad4eee6

Browse files
committed
Fix bugs with headers in Varnish class
1 parent df5f3a2 commit ad4eee6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Invalidation/Varnish.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ public function ban($path, $contentType = self::CONTENT_TYPE_ALL, array $hosts =
9292
$hostRegEx = count($hosts) > 0 ? '^('.join('|', $hosts).')$' : self::REGEX_MATCH_ALL;
9393

9494
$headers = array(
95-
sprintf('%s: %s', self::HTTP_HEADER_HOST, $hostRegEx),
96-
sprintf('%s: %s', self::HTTP_HEADER_URL, $path),
97-
sprintf('%s: %s', self::HTTP_HEADER_CONTENT_TYPE, $contentType)
95+
self::HTTP_HEADER_HOST => $hostRegEx,
96+
self::HTTP_HEADER_URL => $path,
97+
self::HTTP_HEADER_CONTENT_TYPE => $contentType
9898
);
9999

100100
$this->queueRequest(self::HTTP_METHOD_BAN, '/', $headers);
@@ -151,7 +151,7 @@ protected function queueRequest($method, $url, array $headers = array())
151151

152152
// If Host headers hasn't been set and $url doesn't contain a hostname,
153153
// set the Host header to the default hostname
154-
if ('' != $request->getHeader('Host')) {
154+
if ('' == $request->getHeader('Host')) {
155155
$parsedUrl = parse_url($url);
156156
if (!isset($parsedUrl['host'])) {
157157
$request->setHeader('Host', $this->host);

0 commit comments

Comments
 (0)