One more quick question - https
One more quick question - is it/will it be possible to do pattern matching using HTTPS? I can't get it working with HTTPS pages.
Thanks!
Not the best way, but solved it by adding to the queryMonitor function:
public function queryMonitor() { if ($this->port == 443) $prefix = "ssl://"; else $prefix = "";
$sock = @fsockopen($prefix .$this->hostname, $this->port, $errno, $errstr, intval($this->config['timeout']));
Thank you for posting this. It doesn't work with SNI though:
[Sun Apr 03 20:59:34.879104 2016] [ssl:error] [pid 12463:tid 3084380239616] AH02031: Hostname frederik-braun.com provided via SNI, but no hostname provided in HTTP request
It's working here. queryMonitor now looks like this for me:
public function queryMonitor()
{
if ($this->port == 443) {
$ctx = stream_context_create(
array('http' =>
array('timeout' => intval($this->config['timeout']))
)
);
$resp = @file_get_contents("https://" . $this->hostname ."/". $this->config['path']);
$valid = $this->isValid($resp);
}
else {
$sock = @fsockopen($this->hostname, $this->port, $errno, $errstr, intval($this->config['timeout']));
if(!$sock)
return false;
$req = "GET /" . $this->config['path'] . " HTTP/1.1\r\n";
$req .= "Host: " . $this->hostname . "\r\n";
$req .= "Connection: Close\r\n\r\n";
fwrite($sock, $req);
$resp = '';
while(!feof($sock))
{
$resp .= fread($sock, 1024);
}
$valid = $this->isValid($resp);
fclose($sock);
}
if($this->getMode() == HttpValidationMonitor::$MODE_DOES_CONTAIN)
return $valid;
else
return !$valid;
}