File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 5
5
/**
6
6
* Intermediate common class for all cryptographic socket classes such
7
7
* as SSLSocket and TLSSocket.
8
+ *
9
+ * @see http://php.net/manual/en/context.ssl.php
8
10
*/
9
11
class CryptoSocket extends Socket {
10
12
const CTX_WRP = 'ssl ' ; // stream context option key
13
+
11
14
protected $ crpytoImpl = null ;
12
15
16
+ /**
17
+ * Constructor
18
+ *
19
+ * @param string $host hostname or IP address
20
+ * @param int $port
21
+ * @param resource $socket default NULL
22
+ */
23
+ public function __construct ($ host , $ port , $ socket = null ) {
24
+ parent ::__construct ($ host , $ port , $ socket );
25
+
26
+ // Use "localhost" as peer name in these well-known cases.
27
+ if ('localhost ' === $ host || '127.0.0.1 ' === $ host || '[::1] ' === $ host ) {
28
+ $ this ->setSocketOption ('ssl ' , 'peer_name ' , 'localhost ' );
29
+ }
30
+ }
31
+
13
32
/**
14
33
* Connect, then enable crypto
15
34
*
You can’t perform that action at this time.
0 commit comments