mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '3.3' into 3.4
This commit is contained in:
commit
d306c884c7
@ -302,6 +302,9 @@ class HTTP {
|
||||
}
|
||||
|
||||
public static function register_etag($etag) {
|
||||
if (0 !== strpos('"')) {
|
||||
$etag = sprintf('"%s"', $etag);
|
||||
}
|
||||
self::$etag = $etag;
|
||||
}
|
||||
|
||||
@ -450,6 +453,11 @@ class HTTP {
|
||||
$responseHeaders['ETag'] = self::$etag;
|
||||
}
|
||||
|
||||
// etag needs to be a quoted string according to HTTP spec
|
||||
if (!empty($responseHeaders['ETag']) && 0 !== strpos($responseHeaders['ETag'], '"')) {
|
||||
$responseHeaders['ETag'] = sprintf('"%s"', $responseHeaders['ETag']);
|
||||
}
|
||||
|
||||
// Now that we've generated them, either output them or attach them to the SS_HTTPResponse as appropriate
|
||||
foreach($responseHeaders as $k => $v) {
|
||||
if($body) {
|
||||
|
@ -254,6 +254,10 @@ EOT
|
||||
if(!headers_sent($file, $line)) {
|
||||
header($_SERVER['SERVER_PROTOCOL'] . " $this->statusCode " . $this->getStatusDescription());
|
||||
foreach($this->headers as $header => $value) {
|
||||
//etags need to be quoted
|
||||
if (strcasecmp('etag', $header) === 0 && 0 !== strpos($value, '"')) {
|
||||
$value = sprintf('"%s"', $value);
|
||||
}
|
||||
header("$header: $value", true, $this->statusCode);
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user