disable ssl verification on PHP < 5.6
authorChristian Weiske <cweiske@cweiske.de>
Tue, 6 Sep 2016 21:28:57 +0000 (23:28 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 6 Sep 2016 21:28:57 +0000 (23:28 +0200)
src/shpub/Command/Connect.php
src/shpub/Command/Like.php

index bd1606eb849c96f6d64b99d616ac37c4907d41a2..0c86a8bac811e503bc26c9956220435203d7388a 100644 (file)
@@ -71,6 +71,11 @@ class Command_Connect
         $host, $userUrl, $code, $redirect_uri, $state
     ) {
         $req = new \HTTP_Request2($host->endpoints->token, 'POST');
         $host, $userUrl, $code, $redirect_uri, $state
     ) {
         $req = new \HTTP_Request2($host->endpoints->token, 'POST');
+        if (version_compare(PHP_VERSION, '5.6.0', '<')) {
+            //correct ssl validation on php 5.5 is a pain, so disable
+            $req->setConfig('ssl_verify_host', false);
+            $req->setConfig('ssl_verify_peer', false);
+        }
         $req->setHeader('Content-Type: application/x-www-form-urlencoded');
         $req->setBody(
             http_build_query(
         $req->setHeader('Content-Type: application/x-www-form-urlencoded');
         $req->setBody(
             http_build_query(
@@ -136,6 +141,11 @@ class Command_Connect
     protected function verifyAuthCode($host, $code, $state, $redirect_uri, $me)
     {
         $req = new \HTTP_Request2($host->endpoints->authorization, 'POST');
     protected function verifyAuthCode($host, $code, $state, $redirect_uri, $me)
     {
         $req = new \HTTP_Request2($host->endpoints->authorization, 'POST');
+        if (version_compare(PHP_VERSION, '5.6.0', '<')) {
+            //correct ssl validation on php 5.5 is a pain, so disable
+            $req->setConfig('ssl_verify_host', false);
+            $req->setConfig('ssl_verify_peer', false);
+        }
         $req->setHeader('Content-Type: application/x-www-form-urlencoded');
         $req->setBody(
             http_build_query(
         $req->setHeader('Content-Type: application/x-www-form-urlencoded');
         $req->setBody(
             http_build_query(
index 70e836f50b1f0ea95c06ab76132ee76b4fc08f57..8baeee7e70901d47673ab2fb85941a14309cf72a 100644 (file)
@@ -28,6 +28,11 @@ class Command_Like
         );
 
         $req = new \HTTP_Request2($this->host->endpoints->micropub, 'POST');
         );
 
         $req = new \HTTP_Request2($this->host->endpoints->micropub, 'POST');
+        if (version_compare(PHP_VERSION, '5.6.0', '<')) {
+            //correct ssl validation on php 5.5 is a pain, so disable
+            $req->setConfig('ssl_verify_host', false);
+            $req->setConfig('ssl_verify_peer', false);
+        }
         $req->setHeader('Content-type', 'application/x-www-form-urlencoded');
         $req->setHeader('Authorization', 'Bearer ' . $this->host->token);
         $req->setBody($body);
         $req->setHeader('Content-type', 'application/x-www-form-urlencoded');
         $req->setHeader('Authorization', 'Bearer ' . $this->host->token);
         $req->setBody($body);