Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

TestRailAPIException: Unknown SSL protocol error in connection to mnv.testrail.com:443"


#1

I am encountering “TestRailAPIException: Unknown SSL protocol error in connection to mnv.testrail.com:443"” error while posting the results to the TestRail by using PHP TestRail API.

I am not triggering the test cases from UI script instead I am posting the results to the TestRail through my automation scripts using TestRail API directly. On investigating this issue, I noticed that the following exception is thrown by the below mentioned if loop with in protected function _send_request($method, $uri, $data) function in TestRailAPIClient.

$response = curl_exec($ch);
function if ($response === false)
{

		throw new TestRailAPIException(curl_error($ch));
	}

It appears that the response received after the curl execution is false thereby causing it to the above exception.


Bug - Clicking From Summary To Main Test Case Brings Up Error Dialogue
#2

Hello Nupur,

Thanks for your posting and additional details. This looks like an issue with the curl version you use and I found references to this issue here, for example:

http://sourceforge.net/p/curl/bugs/1319/

Do you know which version of the curl HTTP library you have installed? Which Linux system/distribution and version do you use?

Cheers,
Tobias


#3

Hi Tobias,

Thanks for your inputs.

I have windows7 professional system with curl 7.30.0 (i386-pc-win32) libcurl/7.30.0 OpenSSL/0.9.8{ zlib/1.2.7.

I have gone through the reference that you have provided and followed all the steps that are mentioned in the discussion and is able to connect to the site but no HTMl content is displayed instead HTTP/1.1 302 Found is displayed on the git bash. Refer to the attached screenshot <HTTP302.png>

Note :
*** I am also encountering “Unknown SSL error” intermittently** for TestRail
*** For other sites, I am able to view the HTML code and getting “HTTP/1.1 200 OK”**

I am using codeception as a Automation tool and posting the results to the TestRail through my automation scripts using TestRail API and is getting the same error.

Refer Video for more details

Please advise.

Thanks
Nupur


#4

Hello Nupur,

Could you let me know which address you’ve tested? The 302 is a redirect response and wouldn’t usually be returned by the API (only by UI controllers). The SSL problem might be a problem with the SSL version your curl library supports or tries to use but I could be wrong. For security reasons, testrail.com and testrail.net no longer support the old SSL2 and SSL3 protocols, for example.

Cheers,
Tobias


#5

Hi Tobias,

URL used by me is :: “https://mnv.testrail.com

I am now able to get HTTP/1.1 200 OK :relaxed:. HTTP 3XX code means that the requested page has moved to a different location. So on investigating I found following solutions:

Case1: By changing the URL:
https://mnv.testrail.com/ URL redirects to https://mnv.testrail.com/index.php?/auth/login/ URL (You can refer to the above attached screenshot. Location field corresponds to “https://mnv.testrail.com/index.php?/auth/login/”). On passing latter URL, I am able to get HTTP/1.1 200 OK

curl https://mnv.testrail.com/index.php?/auth/login/ -v

Case2: By appending -L, --location to the former URL. Click here to get the details

curl “https://mnv.testrail.com/” -v -L provides me HTTP/1.1 200 OK

Thanks
Nupur


#6

Hi Nupur,

Good to hear that the SSL connection is working now :slight_smile: The / URI always redirects to index.php?/auth/login in case you are not logged in and this is the main entry for accessing TestRail with a browser. The APIs use different endpoints and you can find an overview here:

http://docs.gurock.com/testrail-api2/start

For example, to get a case with ID 1 via the API, you would call:

 curl -H "Content-Type: application/json" \
	-u "user@example.com:<some-password>" \
	"https://example.testrail.com/index.php?/api/v2/get_case/1"

(all in one line and without the backslashes)

You can also find a detailed step by step guide here:

http://docs.gurock.com/testrail-api2/accessing

Cheers,
Tobias