Skip to content

Commit ecccbb1

Browse files
Merge pull request #168 from panaceya/master
Added options verify_peer and verify_peer_name
2 parents a36d0a0 + 2026f70 commit ecccbb1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Protocols/EPP/eppConnection.php

+24
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ class eppConnection {
130130
*/
131131
protected $allow_self_signed = null;
132132

133+
/**
134+
* Require verification of SSL certificate used
135+
* @var boolean
136+
*/
137+
protected $verify_peer = true;
138+
139+
/**
140+
* Require verification of peer name
141+
* @var boolean
142+
*/
143+
protected $verify_peer_name = true;
144+
133145
protected $logentries = array();
134146

135147
protected $checktransactionids = true;
@@ -375,7 +387,11 @@ public function connect($hostname = null, $port = null) {
375387
}
376388
if (isset($this->allow_self_signed)) {
377389
stream_context_set_option($context, 'ssl', 'allow_self_signed', $this->allow_self_signed);
390+
stream_context_set_option($context, 'ssl', 'verify_peer', false);
391+
} else {
392+
stream_context_set_option($context, 'ssl', 'verify_peer', $this->verify_peer);
378393
}
394+
stream_context_set_option($context, 'ssl', 'verify_peer_name', $this->verify_peer_name);
379395
if ($this->connection = stream_socket_client($target, $errno, $errstr, $this->timeout, STREAM_CLIENT_CONNECT, $context)) {
380396
$this->writeLog("Connection made","CONNECT");
381397
$this->connected = true;
@@ -888,6 +904,14 @@ public function setPort($port) {
888904
$this->port = $port;
889905
}
890906

907+
public function setVerifyPeer($verify_peer) {
908+
$this->verify_peer = $verify_peer;
909+
}
910+
911+
public function setVerifyPeerName($verify_peer_name) {
912+
$this->verify_peer_name = $verify_peer_name;
913+
}
914+
891915
public function getRetry()
892916
{
893917
return $this->retry;

0 commit comments

Comments
 (0)