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) {
|
public static function register_etag($etag) {
|
||||||
|
if (0 !== strpos('"')) {
|
||||||
|
$etag = sprintf('"%s"', $etag);
|
||||||
|
}
|
||||||
self::$etag = $etag;
|
self::$etag = $etag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,6 +453,11 @@ class HTTP {
|
|||||||
$responseHeaders['ETag'] = self::$etag;
|
$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
|
// Now that we've generated them, either output them or attach them to the SS_HTTPResponse as appropriate
|
||||||
foreach($responseHeaders as $k => $v) {
|
foreach($responseHeaders as $k => $v) {
|
||||||
if($body) {
|
if($body) {
|
||||||
|
@ -254,6 +254,10 @@ EOT
|
|||||||
if(!headers_sent($file, $line)) {
|
if(!headers_sent($file, $line)) {
|
||||||
header($_SERVER['SERVER_PROTOCOL'] . " $this->statusCode " . $this->getStatusDescription());
|
header($_SERVER['SERVER_PROTOCOL'] . " $this->statusCode " . $this->getStatusDescription());
|
||||||
foreach($this->headers as $header => $value) {
|
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);
|
header("$header: $value", true, $this->statusCode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user