@@ -57,13 +57,6 @@ class EntitySource
5757 */
5858 protected string $ url ;
5959
60- /**
61- * The SSL CA file that should be used to validate the connection.
62- *
63- * @var string|null
64- */
65- protected ?string $ sslCAFile ;
66-
6760 /**
6861 * The certificate we should use to validate downloaded metadata.
6962 *
@@ -111,10 +104,6 @@ public function __construct(Aggregator $aggregator, Configuration $config)
111104 $ this ->aggregator = $ aggregator ;
112105
113106 $ this ->url = $ config ->getString ('url ' );
114- $ this ->sslCAFile = $ config ->getOptionalString ('ssl.cafile ' , null );
115- if ($ this ->sslCAFile === null ) {
116- $ this ->sslCAFile = $ aggregator ->getCAFile ();
117- }
118107
119108 $ this ->certificate = $ config ->getOptionalString ('cert ' , null );
120109
@@ -134,23 +123,18 @@ private function downloadMetadata(): EntitiesDescriptor|EntityDescriptor|null
134123 Logger::debug ($ this ->logLoc . 'Downloading metadata from ' . var_export ($ this ->url , true ));
135124 $ configUtils = new Utils \Config ();
136125
137- $ context = ['ssl ' => []];
138- if ($ this ->sslCAFile !== null ) {
139- $ context ['ssl ' ]['cafile ' ] = $ configUtils ->getCertPath ($ this ->sslCAFile );
140- Logger::debug (
141- $ this ->logLoc . 'Validating https connection against CA certificate(s) found in ' .
142- var_export ($ context ['ssl ' ]['cafile ' ], true ),
143- );
144- $ context ['ssl ' ]['verify_peer ' ] = true ;
145- $ context ['ssl ' ]['CN_match ' ] = parse_url ($ this ->url , PHP_URL_HOST );
146- }
126+ $ httpUtils = new Utils \HTTP ();
127+ $ client = $ httpUtils ->createHttpClient ();
128+ $ response = $ client ->request ('GET ' , $ this ->url );
147129
148130 try {
149- $ httpUtils = new Utils \ HTTP ();
150- $ data = $ httpUtils -> fetch ( $ this -> url , $ context , false );
151- } catch (Error \ Exception $ e ) {
152- Logger::error ($ this -> logLoc . 'Unable to load metadata from ' . var_export ($ this ->url , true ));
131+ // Trigger any issues that may occur during transport
132+ $ statusCode = $ response -> getStatusCode ( );
133+ } catch (TransportException $ e ) {
134+ Logger::error ('Unable to load metadata from ' . var_export ($ this ->url , true ));
153135 return null ;
136+ } finally {
137+ $ data = $ response ->getContent ();
154138 }
155139
156140 $ doc = DOMDocumentFactory::create ();
0 commit comments