diff --git a/lib/private/appframework/http.php b/lib/private/appframework/http.php index e7b0d1e2ca..dee9818f4b 100644 --- a/lib/private/appframework/http.php +++ b/lib/private/appframework/http.php @@ -121,7 +121,7 @@ class Http extends BaseHttp { // if etag or lastmodified have not changed, return a not modified if ((isset($this->server['HTTP_IF_NONE_MATCH']) - && trim($this->server['HTTP_IF_NONE_MATCH']) === $ETag) + && trim(trim($this->server['HTTP_IF_NONE_MATCH']), '"') === (string)$ETag) || diff --git a/tests/lib/appframework/http/HttpTest.php b/tests/lib/appframework/http/HttpTest.php index e9be3e7390..4bcc8305db 100644 --- a/tests/lib/appframework/http/HttpTest.php +++ b/tests/lib/appframework/http/HttpTest.php @@ -65,6 +65,14 @@ class HttpTest extends \Test\TestCase { } + public function testQuotedEtagMatchReturnsNotModified() { + $http = new Http(array('HTTP_IF_NONE_MATCH' => '"hi"')); + + $header = $http->getStatusHeader(Http::STATUS_OK, null, 'hi'); + $this->assertEquals('HTTP/1.1 304 Not Modified', $header); + } + + public function testLastModifiedMatchReturnsNotModified() { $dateTime = new \DateTime(null, new \DateTimeZone('GMT')); $dateTime->setTimestamp('12');