Skip to content

Commit

Permalink
[HttpKernel] fixed empty ETags showing up in requests to the backend …
Browse files Browse the repository at this point in the history
…when using HttpCache
  • Loading branch information
fabpot committed May 18, 2011
1 parent a15e846 commit 1f0ffca
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
Expand Up @@ -325,10 +325,11 @@ protected function validate(Request $request, Response $entry, $catch = false)
// Add our cached etag validator to the environment.
// We keep the etags from the client to handle the case when the client
// has a different private valid entry which is not cached here.
$cachedEtags = array($entry->getEtag());
$cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array();
$requestEtags = $request->getEtags();
$etags = array_unique(array_merge($cachedEtags, $requestEtags));
$subRequest->headers->set('if_none_match', $etags ? implode(', ', $etags) : '');
if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) {
$subRequest->headers->set('if_none_match', implode(', ', $etags));
}

$response = $this->forward($subRequest, $catch, $entry);

Expand Down

0 comments on commit 1f0ffca

Please sign in to comment.