Skip to content

Redmine API via SSL #2

@wsuff

Description

@wsuff

On the install I'm working on we just switched over to SSL for security reasons but unfortunately it appears this library assumes HTTP so all my logic against the redmine api no longer works. I'd assume it would be mostly changes to the client.php usage of CURL.

https://gist.github.com/159552ef7d45a1553aa5

diff --git a/lib/Redmine/Client.php b/lib/Redmine/Client.php
index 6fad9b9..4082d7c 100644
--- a/lib/Redmine/Client.php
+++ b/lib/Redmine/Client.php
@@ -172,10 +172,11 @@ class Client
             curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
         }
         curl_setopt($curl, CURLOPT_URL, $this->url.$path);
-        curl_setopt($curl, CURLOPT_PORT , 80);
+        curl_setopt($curl, CURLOPT_PORT , 443);
         curl_setopt($curl, CURLOPT_VERBOSE, 0);
         curl_setopt($curl, CURLOPT_HEADER, 0);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

         $tmp = parse_url($path);
         if ('xml' === substr($tmp['path'], -3)) {

was enough to satisfy my immediate need.

Better solution as I see it is below:

  1. Check beginning of URL for http/ https
  2. Check URL for : portnum
  3. Add an additional function how how curl should treat SSL ignore invalid cert etc.

In this case it's selfsigned so it can't be verified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions