File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ class Client
38
38
protected $ connect_timeout ;
39
39
protected $ timeout ;
40
40
protected $ chunk_size ;
41
+ protected $ verify_peer_name ;
41
42
42
43
public function __construct (array $ config )
43
44
{
@@ -108,6 +109,12 @@ public function __construct(array $config)
108
109
} else {
109
110
$ this ->chunk_size = 1024 ;
110
111
}
112
+
113
+ if (!empty ($ config ['verify_peer_name ' ])) {
114
+ $ this ->verify_peer_name = (bool ) $ config ['verify_peer_name ' ];
115
+ } else {
116
+ $ this ->verify_peer_name = true ;
117
+ }
111
118
}
112
119
113
120
public function __destruct ()
@@ -125,6 +132,7 @@ public function connect()
125
132
126
133
$ context = stream_context_create ();
127
134
stream_context_set_option ($ context , 'ssl ' , 'verify_peer ' , false );
135
+ stream_context_set_option ($ context , 'ssl ' , 'verify_peer_name ' , $ this ->verify_peer_name );
128
136
stream_context_set_option ($ context , 'ssl ' , 'allow_self_signed ' , true );
129
137
130
138
if ($ this ->local_cert !== null ) {
You can’t perform that action at this time.
0 commit comments