Skip to content

Commit

Permalink
Add Cache-Control to default allowed cors headers
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt committed Apr 28, 2022
1 parent be2d40f commit 66a81da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/dav/tests/unit/Connector/Sabre/CorsPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function optionsCases() {
'If-Modified-Since', 'If-None-Match', 'If-Range', 'If-Unmodified-Since',
'Location', 'Lock-Token', 'Overwrite', 'Prefer', 'Range', 'Schedule-Reply',
'Timeout', 'User-Agent', 'X-Expected-Entity-Length', 'Accept-Language',
'Access-Control-Request-Method', 'Access-Control-Allow-Origin', 'ETag',
'Access-Control-Request-Method', 'Access-Control-Allow-Origin', 'Cache-Control', 'ETag',
'OC-Autorename', 'OC-CalDav-Import', 'OC-Chunked', 'OC-Etag', 'OC-FileId',
'OC-LazyOps', 'OC-Total-File-Length', 'Origin', 'X-Request-ID', 'X-Requested-With'
];
Expand Down Expand Up @@ -349,7 +349,7 @@ public function testAuthenticatedAdditionalAllowedHeaders() {

$this->plugin->setCorsHeaders($this->server->httpRequest, $this->server->httpResponse);
self::assertEquals(
'X-Additional-Configured-Header,authorization,OC-Checksum,OC-Total-Length,OCS-APIREQUEST,X-OC-Mtime,OC-RequestAppPassword,Accept,Authorization,Brief,Content-Length,Content-Range,Content-Type,Date,Depth,Destination,Host,If,If-Match,If-Modified-Since,If-None-Match,If-Range,If-Unmodified-Since,Location,Lock-Token,Overwrite,Prefer,Range,Schedule-Reply,Timeout,User-Agent,X-Expected-Entity-Length,Accept-Language,Access-Control-Request-Method,Access-Control-Allow-Origin,ETag,OC-Autorename,OC-CalDav-Import,OC-Chunked,OC-Etag,OC-FileId,OC-LazyOps,OC-Total-File-Length,Origin,X-Request-ID,X-Requested-With',
'X-Additional-Configured-Header,authorization,OC-Checksum,OC-Total-Length,OCS-APIREQUEST,X-OC-Mtime,OC-RequestAppPassword,Accept,Authorization,Brief,Content-Length,Content-Range,Content-Type,Date,Depth,Destination,Host,If,If-Match,If-Modified-Since,If-None-Match,If-Range,If-Unmodified-Since,Location,Lock-Token,Overwrite,Prefer,Range,Schedule-Reply,Timeout,User-Agent,X-Expected-Entity-Length,Accept-Language,Access-Control-Request-Method,Access-Control-Allow-Origin,Cache-Control,ETag,OC-Autorename,OC-CalDav-Import,OC-Chunked,OC-Etag,OC-FileId,OC-LazyOps,OC-Total-File-Length,Origin,X-Request-ID,X-Requested-With',
$this->server->httpResponse->getHeader('Access-Control-Allow-Headers')
);
}
Expand All @@ -371,7 +371,7 @@ public function testUnauthenticatedAdditionalAllowedHeaders() {

$this->plugin->setCorsHeaders($this->server->httpRequest, $this->server->httpResponse);
self::assertEquals(
'X-Additional-Configured-Header,authorization,OC-Checksum,OC-Total-Length,OCS-APIREQUEST,X-OC-Mtime,OC-RequestAppPassword,Accept,Authorization,Brief,Content-Length,Content-Range,Content-Type,Date,Depth,Destination,Host,If,If-Match,If-Modified-Since,If-None-Match,If-Range,If-Unmodified-Since,Location,Lock-Token,Overwrite,Prefer,Range,Schedule-Reply,Timeout,User-Agent,X-Expected-Entity-Length,Accept-Language,Access-Control-Request-Method,Access-Control-Allow-Origin,ETag,OC-Autorename,OC-CalDav-Import,OC-Chunked,OC-Etag,OC-FileId,OC-LazyOps,OC-Total-File-Length,Origin,X-Request-ID,X-Requested-With',
'X-Additional-Configured-Header,authorization,OC-Checksum,OC-Total-Length,OCS-APIREQUEST,X-OC-Mtime,OC-RequestAppPassword,Accept,Authorization,Brief,Content-Length,Content-Range,Content-Type,Date,Depth,Destination,Host,If,If-Match,If-Modified-Since,If-None-Match,If-Range,If-Unmodified-Since,Location,Lock-Token,Overwrite,Prefer,Range,Schedule-Reply,Timeout,User-Agent,X-Expected-Entity-Length,Accept-Language,Access-Control-Request-Method,Access-Control-Allow-Origin,Cache-Control,ETag,OC-Autorename,OC-CalDav-Import,OC-Chunked,OC-Etag,OC-FileId,OC-LazyOps,OC-Total-File-Length,Origin,X-Request-ID,X-Requested-With',
$this->server->httpResponse->getHeader('Access-Control-Allow-Headers')
);
}
Expand Down
1 change: 1 addition & 0 deletions lib/private/legacy/response.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ private static function getAllowedCorsHeaders(\OCP\IConfig $config = null) {
'Accept-Language',
'Access-Control-Request-Method',
'Access-Control-Allow-Origin',
'Cache-Control',
'ETag',
'OC-Autorename',
'OC-CalDav-Import',
Expand Down

0 comments on commit 66a81da

Please sign in to comment.