MDL-14793
authorthepurpleblob <thepurpleblob>
Mon, 30 Jun 2008 14:16:39 +0000 (14:16 +0000)
committerthepurpleblob <thepurpleblob>
Mon, 30 Jun 2008 14:16:39 +0000 (14:16 +0000)
Added some debugging messages, if anything fails.

Merged from STABLE_19

mnet/lib.php

index d453149bf0388ae97defa07d50b8f92b860f0205..e50355802ad6000cb8ae84413444f8f943dc0b7c 100644 (file)
@@ -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;
 }