From 90715d7a8d250bb229c18e6937e49b4614b8d61d Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Mon, 30 Jun 2008 14:16:39 +0000 Subject: [PATCH] MDL-14793 Added some debugging messages, if anything fails. Merged from STABLE_19 --- mnet/lib.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mnet/lib.php b/mnet/lib.php index d453149bf0..e50355802a 100644 --- a/mnet/lib.php +++ b/mnet/lib.php @@ -100,6 +100,19 @@ function mnet_get_public_key($uri, $application=null) { } $res = xmlrpc_decode(curl_exec($ch)); + + // check for curl errors + $curlerrno = curl_errno($ch); + if ($curlerrno!=0) { + debugging("Request for $uri failed with curl error $curlerrno"); + } + + // check HTTP error code + $info = curl_getinfo($ch); + if (!empty($info['http_code']) and ($info['http_code'] != 200)) { + debugging("Request for $uri failed with HTTP code ".$info['http_code']); + } + curl_close($ch); if (!is_array($res)) { // ! error @@ -115,8 +128,17 @@ function mnet_get_public_key($uri, $application=null) { mnet_set_public_key($uri, $public_certificate); return $public_certificate; } + else { + debugging("Request for $uri returned public key for different URI - $host"); + } + } + else { + debugging("Request for $uri returned empty response"); } } + else { + debugging( "Request for $uri returned unexpected result"); + } return false; } -- 2.39.5