mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Skip md5-ing the whole contents of a stream for etags
This commit is contained in:
parent
40f06fafa9
commit
0abfed3e06
@ -4,6 +4,7 @@ namespace SilverStripe\Control\Middleware;
|
||||
|
||||
use SilverStripe\Control\HTTPRequest;
|
||||
use SilverStripe\Control\HTTPResponse;
|
||||
use SilverStripe\Control\HTTPStreamResponse;
|
||||
use SilverStripe\Core\Injector\Injectable;
|
||||
|
||||
/**
|
||||
@ -69,6 +70,11 @@ class ChangeDetectionMiddleware implements HTTPMiddleware
|
||||
return $etag;
|
||||
}
|
||||
|
||||
// Skip parsing the whole body of a stream
|
||||
if ($response instanceof HTTPStreamResponse) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Generate etag from body
|
||||
return sprintf('"%s"', md5($response->getBody()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user