File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ The same mechanic is offered to perform `PUT` and `PATCH` requests wich all are
131131
132132The following example shows the usage with a more detailed configuration.
133133
134- #### Configuring a HTTP Transport instance
134+ #### Configuring an HTTP Transport instance
135135
136136``` {php}
137137use ChromaX\BasicHttpClient\Request\Transport\HttpTransport;
@@ -147,7 +147,7 @@ $transport
147147 ->setMaxRedirects(10);
148148```
149149
150- #### Configuring a HTTPS Transport instance
150+ #### Configuring an HTTPS Transport instance
151151
152152``` {php}
153153use ChromaX\BasicHttpClient\Request\Transport\HttpsTransport;
@@ -161,6 +161,7 @@ $transport
161161 ->setAllowCaching(true)
162162 ->setFollowRedirects(true)
163163 ->setMaxRedirects(10)
164+ ->setVerifyHost(true)
164165 ->setVerifyPeer(true);
165166```
166167
Original file line number Diff line number Diff line change 1010class HttpsTransport extends HttpTransport
1111{
1212
13+ /**
14+ * Whether to verify the peer SSL certificate
15+ *
16+ * @var bool
17+ */
18+ protected $ verifyHost = true ;
19+
1320 /**
1421 * Whether to verify the peer SSL certificate
1522 *
1623 * @var bool
1724 */
1825 protected $ verifyPeer = true ;
1926
27+ /**
28+ * @return bool
29+ */
30+ public function getVerifyHost (): bool
31+ {
32+ return $ this ->verifyHost ;
33+ }
34+
35+ /**
36+ * @param bool $verifyHost
37+ */
38+ public function setVerifyHost (bool $ verifyHost )
39+ {
40+ $ this ->verifyHost = $ verifyHost ;
41+ return $ this ;
42+ }
43+
2044 /**
2145 * @return bool
2246 */
@@ -42,6 +66,8 @@ public function setVerifyPeer(bool $verifyPeer)
4266 public function configureCurl ($ curl )
4367 {
4468 parent ::configureCurl ($ curl );
69+ // Verify host
70+ curl_setopt ($ curl , CURLOPT_SSL_VERIFYHOST , $ this ->verifyHost ? 2 : 0 );
4571 // Verify peer
4672 curl_setopt ($ curl , CURLOPT_SSL_VERIFYPEER , $ this ->verifyPeer );
4773 return $ this ;
You can’t perform that action at this time.
0 commit comments