Skip to content

Commit

Permalink
Merge pull request #311 from soulseekah/fix-fsockopen-verify
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera authored Oct 20, 2020
2 parents f89c2fa + 1007e5f commit 7626082
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/Requests/Transport/fsockopen.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
10 changes: 10 additions & 0 deletions tests/Transport/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 7626082

Please sign in to comment.