Skip to content

Commit

Permalink
Merge pull request #18730 from owncloud/appframework_proper_304
Browse files Browse the repository at this point in the history
Properly return 304 in AppFramework
  • Loading branch information
Vincent Petry committed Sep 1, 2015
2 parents 0115267 + f12caf9 commit 87b3e28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/appframework/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function getStatusHeader($status, \DateTime $lastModified=null,

// 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)

||

Expand Down
8 changes: 8 additions & 0 deletions tests/lib/appframework/http/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ public function testEtagMatchReturnsNotModified() {
}


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');
Expand Down

0 comments on commit 87b3e28

Please sign in to comment.