Skip to content

Commit b860ee1

Browse files
committed
Merge branch 'master' into feature/seperateCacheHeaderAndCaching
# Conflicts: # Classes/Http/RequestInterceptorComponent.php
2 parents 49f0e3a + a766dea commit b860ee1

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

Classes/Http/RequestInterceptorComponent.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ public function handle(ComponentContext $componentContext)
6666

6767
$entry = $this->cacheFrontend->get($entryIdentifier);
6868
if ($entry) {
69-
$cachedResponse = parse_response($entry);
69+
if (class_exists('Neos\\Flow\\Http\\Response')) {
70+
$cachedResponse = \Neos\Flow\Http\Response::createFromRaw($entry);
71+
} else {
72+
$cachedResponse = parse_response($entry);
73+
}
7074

7175
$etag = $cachedResponse->getHeaderLine('ETag');
7276
$lifetime = (int)$cachedResponse->getHeaderLine('X-Storage-Lifetime');
@@ -79,7 +83,12 @@ public function handle(ComponentContext $componentContext)
7983

8084
$ifNoneMatch = $request->getHeaderLine('If-None-Match');
8185
if ($ifNoneMatch && $ifNoneMatch === $etag ) {
82-
$response = (new Response( 304))
86+
if (class_exists('Neos\\Flow\\Http\\Response')) {
87+
$response = new \Neos\Flow\Http\Response();
88+
} else {
89+
$response = new Response(304);
90+
}
91+
$response = $response
8392
->withHeader('CacheControl', 'max-age=' . ($lifetime - $age))
8493
->withHeader('X-From-FullPageCache', $entryIdentifier);
8594
} else {

Classes/Http/RequestStorageComponent.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ public function handle(ComponentContext $componentContext)
6161

6262
$ifNoneMatch = $request->getHeaderLine('If-None-Match');
6363
if ($ifNoneMatch && $ifNoneMatch === $etag ) {
64-
$notModifiedResponse = (new Response(304))
64+
if (class_exists('Neos\\Flow\\Http\\Response')) {
65+
$notModifiedResponse = new \Neos\Flow\Http\Response();
66+
} else {
67+
$notModifiedResponse = new Response(304);
68+
}
69+
$notModifiedResponse = $notModifiedResponse
6570
->withAddedHeader('CacheControl', 'max-age=' . $lifetime)
6671
->withHeader('X-From-FullPageCache', $entryIdentifier);
6772
$componentContext->replaceHttpResponse($notModifiedResponse);

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "flowpack/fullpagecache",
55
"license": "MIT",
66
"require": {
7-
"neos/neos": "^5.0 || dev-master"
7+
"neos/neos": "~4.3.6 || ^5.0 || dev-master"
88
},
99
"autoload": {
1010
"psr-4": {

0 commit comments

Comments
 (0)