Skip to content

Commit 5223b88

Browse files
Merge branch 'master' into fix/set-cookie-domain
2 parents f11b84c + a661f25 commit 5223b88

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/GateKeeper.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class GateKeeper
2525
private $debug = false;
2626
private $timer;
2727
private $cookieDomain;
28+
private $ignoreRequest = false;
2829
public $token;
2930
public $ip='192.168.0.1';
3031
public $agent='undetected';
@@ -53,6 +54,10 @@ public function __construct(Client $client, \Psr\Http\Message\ServerRequestInter
5354

5455
$this->setCookieDomain($server);
5556

57+
if (isset($server['REQUEST_SCHEME'])){
58+
$this->ignoreRequest = strtolower($server['REQUEST_SCHEME']) != "https";
59+
}
60+
5661
// Token in URL
5762
if (isset($get[self::TOKEN_URL])) {
5863
$this->setCookie($get[self::TOKEN_URL]);
@@ -91,7 +96,7 @@ private function sanitizeURL ($url, $get)
9196
}
9297

9398
$remaining_query_parameters = array_diff($get, $ch_params_to_remove);
94-
99+
$remaining_query_parameters['ch-fresh'] = uniqid();
95100
if (Count($remaining_query_parameters) > 0) {
96101
$this->url = $this->url .= '?' . http_build_query($remaining_query_parameters);
97102
}
@@ -185,7 +190,7 @@ private function ignoreUrl()
185190
*/
186191
public function checkRequest()
187192
{
188-
if($this->ignoreUrl()) {
193+
if($this->ignoreUrl() || $this->ignoreRequest) {
189194
$mock = new ApiObject;
190195
$mock->status = 0;
191196
$mock->token = $this->token;

0 commit comments

Comments
 (0)