# HG changeset patch # User Alain Mazy # Date 1726841104 -7200 # Node ID 2854418a7c0d52d124b385576a21bf7c1ab60308 # Parent b5dbdde5f6645adb46d99b175ff041711b83f708 fix unit tests diff -r b5dbdde5f664 -r 2854418a7c0d OrthancFramework/Resources/RetrieveCACertificates.py --- a/OrthancFramework/Resources/RetrieveCACertificates.py Fri Sep 20 08:20:29 2024 +0200 +++ b/OrthancFramework/Resources/RetrieveCACertificates.py Fri Sep 20 16:05:04 2024 +0200 @@ -32,7 +32,7 @@ print('Download a set of CA certificates, convert them to PEM, then format them as a C macro') print('Usage: %s [Macro] [Certificate1] ...' % sys.argv[0]) print('') - print('Example: %s BITBUCKET_CERTIFICATES https://cacerts.digicert.com/DigiCertSHA2HighAssuranceServerCA.crt' % sys.argv[0]) + print('Example: %s GITHUB_CERTIFICATES https://cacerts.digicert.com/DigiCertSHA2HighAssuranceServerCA.crt' % sys.argv[0]) print('') sys.exit(-1) diff -r b5dbdde5f664 -r 2854418a7c0d OrthancFramework/UnitTestsSources/BitbucketCACertificates.h --- a/OrthancFramework/UnitTestsSources/BitbucketCACertificates.h Fri Sep 20 08:20:29 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#define BITBUCKET_CERTIFICATES \ -"-----BEGIN CERTIFICATE-----\n" \ -"MIIEtjCCA56gAwIBAgIQDHmpRLCMEZUgkmFf4msdgzANBgkqhkiG9w0BAQsFADBs\n" \ -"MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" \ -"d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j\n" \ -"ZSBFViBSb290IENBMB4XDTEzMTAyMjEyMDAwMFoXDTI4MTAyMjEyMDAwMFowdTEL\n" \ -"MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3\n" \ -"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bh\n" \ -"hgLtxaDwNBx0wY12zIYKqPBKikLWP8ipTa18CK3mtlC4ohpNiAexKSHc59rGPCHg\n" \ -"4xFJcKx6HQGkyhE6V6t9VypAdP3THYUYUN9XR3WhfVUgLkc3UHKMf4Ib0mKPLQNa\n" \ -"2sPIoc4sUqIAY+tzunHISScjl2SFnjgOrWNoPLpSgVh5oywM395t6zHyuqB8bPEs\n" \ -"1OG9d4Q3A84ytciagRpKkk47RpqF/oOi+Z6Mo8wNXrM9zwR4jxQUezKcxwCmXMS1\n" \ -"oVWNWlZopCJwqjyBcdmdqEU79OX2olHdx3ti6G8MdOu42vi/hw15UJGQmxg7kVkn\n" \ -"8TUoE6smftX3eg==\n" \ -"-----END CERTIFICATE-----\n" \ -"\n" diff -r b5dbdde5f664 -r 2854418a7c0d OrthancFramework/UnitTestsSources/GithubCACertificates.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OrthancFramework/UnitTestsSources/GithubCACertificates.h Fri Sep 20 16:05:04 2024 +0200 @@ -0,0 +1,30 @@ +#define GITHUB_CERTIFICATES \ +"-----BEGIN CERTIFICATE-----\n" \ +"MIIEyDCCA7CgAwIBAgIQDPW9BitWAvR6uFAsI8zwZjANBgkqhkiG9w0BAQsFADBh\n" \ +"MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n" \ +"d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH\n" \ +"MjAeFw0yMTAzMzAwMDAwMDBaFw0zMTAzMjkyMzU5NTlaMFkxCzAJBgNVBAYTAlVT\n" \ +"MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxMzAxBgNVBAMTKkRpZ2lDZXJ0IEdsb2Jh\n" \ +"bCBHMiBUTFMgUlNBIFNIQTI1NiAyMDIwIENBMTCCASIwDQYJKoZIhvcNAQEBBQAD\n" \ +"ggEPADCCAQoCggEBAMz3EGJ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iwla3JLko716f2b4gp/DA/JIS7w7d7kwcsr4drdjPtAFVS\n" \ +"slme5LnQ89/nD/7d+MS5EHKBCQRfz5eeLjJ1js+aWNJXMX43AYGyZm0pGrFmCW3R\n" \ +"bpD0ufovARTFXFZkAdl9h6g4U5+LXUZtXMYnhIHUfoyMo5tS58aI7Dd8KvvwVVo4\n" \ +"chDYABPPTHPbqjc1qCmBaZx2vN4Ye5DUys/vZwP9BFohFrH/6j/f3IL16/RZkiMN\n" \ +"JCqVJUzKoZHm1Lesh3Sz8W2jmdv51b2EQJ8HmA==\n" \ +"-----END CERTIFICATE-----\n" \ +"\n" diff -r b5dbdde5f664 -r 2854418a7c0d OrthancFramework/UnitTestsSources/RestApiTests.cpp --- a/OrthancFramework/UnitTestsSources/RestApiTests.cpp Fri Sep 20 08:20:29 2024 +0200 +++ b/OrthancFramework/UnitTestsSources/RestApiTests.cpp Fri Sep 20 16:05:04 2024 +0200 @@ -98,20 +98,20 @@ (1) We retrieve the URI of the root CA of BitBucket: - # echo | openssl s_client -servername bitbucket.org -connect bitbucket.org:443 2>/dev/null | openssl x509 -text | grep "CA Issuers" + # echo | openssl s_client -servername raw.githubusercontent.com -connect raw.githubusercontent.com:443 2>/dev/null | openssl x509 -text | grep "CA Issuers" (2) Once we get the URL to the CA certificate, we convert it to a C macro that can be used by libcurl: # cd UnitTestsSources - # python2 ../Resources/RetrieveCACertificates.py BITBUCKET_CERTIFICATES http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt > BitbucketCACertificates.h + # python2 ../Resources/RetrieveCACertificates.py GITHUB_CERTIFICATES http://cacerts.digicert.com/DigiCertGlobalG2TLSRSASHA2562020CA1-1.crt > GithubCACertificates.h **/ -#include "BitbucketCACertificates.h" +#include "GithubCACertificates.h" TEST(HttpClient, Ssl) { - SystemToolbox::WriteFile(BITBUCKET_CERTIFICATES, "UnitTestsResults/bitbucket.cert"); + SystemToolbox::WriteFile(GITHUB_CERTIFICATES, "UnitTestsResults/github.cert"); /*{ std::string s; @@ -122,12 +122,12 @@ HttpClient c; //c.SetVerbose(true); c.SetHttpsVerifyPeers(true); - c.SetHttpsCACertificates("UnitTestsResults/bitbucket.cert"); + c.SetHttpsCACertificates("UnitTestsResults/github.cert"); // Test file modified on 2020-04-20, in order to use a git // repository on BitBucket instead of a Mercurial repository // (because Mercurial support disappears on 2020-05-31) - c.SetUrl("https://github.com/orthanc-server/orthanc-setup-samples/tree/master/docker/serve-folders/orthanc/serve-folders.json"); + c.SetUrl("https://raw.githubusercontent.com/orthanc-server/orthanc-setup-samples/refs/heads/master/docker/serve-folders/orthanc/serve-folders.json"); Json::Value v; c.Apply(v); @@ -138,7 +138,7 @@ { HttpClient c; c.SetHttpsVerifyPeers(false); - c.SetUrl("https://github.com/orthanc-server/orthanc-setup-samples/tree/master/docker/serve-folders/orthanc/serve-folders.json"); + c.SetUrl("https://raw.githubusercontent.com/orthanc-server/orthanc-setup-samples/refs/heads/master/docker/serve-folders/orthanc/serve-folders.json"); Json::Value v; c.Apply(v);