You are here

function CDNUnitTestCase::setRequestProtocol in CDN 7.2

Set the protocol of the current "request".

Parameters

$protocol: 'http' or 'https'.

2 calls to CDNUnitTestCase::setRequestProtocol()
CDNOriginPullTestCase::testMapping in tests/cdn.test
CDNUnitTestCase::setUp in tests/cdn.test
Sets up unit test environment.

File

tests/cdn.test, line 90
Test CDN.

Class

CDNUnitTestCase
@file Test CDN.

Code

function setRequestProtocol($protocol) {
  if ($protocol == 'http') {
    $_SERVER['HTTPS'] = 'off';
    $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'http';
  }
  elseif ($protocol == 'https') {
    $_SERVER['HTTPS'] = 'on';
    $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
  }
}