public function SecKitEventSubscriber::seckitExpectCt in Security Kit 8
Same name and namespace in other branches
- 2.x src/EventSubscriber/SecKitEventSubscriber.php \Drupal\seckit\EventSubscriber\SecKitEventSubscriber::seckitExpectCt()
Sends Expect-CT HTTP response header.
Implementation is based on specification draft available at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect-CT.
1 call to SecKitEventSubscriber::seckitExpectCt()
- SecKitEventSubscriber::onKernelResponse in src/
EventSubscriber/ SecKitEventSubscriber.php - Executes actions on the response event.
File
- src/
EventSubscriber/ SecKitEventSubscriber.php, line 480
Class
- SecKitEventSubscriber
- Subscribing an event.
Namespace
Drupal\seckit\EventSubscriberCode
public function seckitExpectCt() {
$header[] = sprintf("max-age=%d", $this->config
->get('seckit_ct.max_age'));
if ($this->config
->get('seckit_ct.enforce')) {
$header[] = 'enforce';
}
if ($this->config
->get('seckit_ct.report_uri')) {
$header[] = 'report-uri="' . $this->config
->get('seckit_ct.report_uri') . '"';
}
$header = implode(', ', $header);
$this->response->headers
->set('Expect-CT', $header);
}