@@ -134,23 +134,18 @@ private function downloadMetadata(): EntitiesDescriptor|EntityDescriptor|null
134134 Logger::debug ($ this ->logLoc . 'Downloading metadata from ' . var_export ($ this ->url , true ));
135135 $ configUtils = new Utils \Config ();
136136
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- }
137+ $ httpUtils = new Utils \HTTP ();
138+ $ client = $ httpUtils ->createHttpClient ();
139+ $ response = $ client ->request ('GET ' , $ this ->url );
147140
148141 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 ));
142+ // Trigger any issues that may occur during transport
143+ $ statusCode = $ response -> getStatusCode ( );
144+ } catch (TransportException $ e ) {
145+ Logger::error ('Unable to load metadata from ' . var_export ($ this ->url , true ));
153146 return null ;
147+ } finally {
148+ $ data = $ response ->getContent ();
154149 }
155150
156151 $ doc = DOMDocumentFactory::create ();
0 commit comments