From 72c34d623246818ac4c52435ccc170bc583f4797 Mon Sep 17 00:00:00 2001 From: Gennady Kovshenin Date: Sun, 11 Feb 2018 22:05:47 +0500 Subject: [PATCH 1/2] Add verify => false tests See #310 fsockopen will fail --- tests/Transport/Base.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Transport/Base.php b/tests/Transport/Base.php index ebd6ca98a..7103e1f34 100644 --- a/tests/Transport/Base.php +++ b/tests/Transport/Base.php @@ -567,6 +567,16 @@ public function testBadDomain() { $request = Requests::head('https://wrong.host.badssl.com/', array(), $this->getOptions()); } + public function testBadDomainNoVerify() { + if ($this->skip_https) { + $this->markTestSkipped('SSL support is not available.'); + return; + } + + $response = Requests::head('https://wrong.host.badssl.com/', array(), $this->getOptions(array('verify' => false))); + $this->assertTrue($response->success); + } + /** * Test that the transport supports Server Name Indication with HTTPS * From 1007e5fdff30d42db0dc1e7002d8186cf1937e4c Mon Sep 17 00:00:00 2001 From: Gennady Kovshenin Date: Sun, 11 Feb 2018 22:21:03 +0500 Subject: [PATCH 2/2] fsockopen SSL no verify == no verifyname As per the documentation setting verify to false suppresses all SSL checks. Fixes #310 --- library/Requests/Transport/fsockopen.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/Requests/Transport/fsockopen.php b/library/Requests/Transport/fsockopen.php index c7c61d3b1..7972c265e 100644 --- a/library/Requests/Transport/fsockopen.php +++ b/library/Requests/Transport/fsockopen.php @@ -92,6 +92,8 @@ public function request($url, $headers = array(), $data = array(), $options = ar if (isset($options['verify'])) { if ($options['verify'] === false) { $context_options['verify_peer'] = false; + $context_options['verify_peer_name'] = false; + $verifyname = false; } elseif (is_string($options['verify'])) { $context_options['cafile'] = $options['verify'];