diff options
author | friendica <info@friendica.com> | 2014-03-23 15:24:38 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-03-23 15:24:38 -0700 |
commit | b6b4ffa68d6deab233dcda06113a849ac78f8f84 (patch) | |
tree | 23ec59b1214c418d1832fd4491397e6f7f6c87f4 | |
parent | d8577ac7b53fbf2ceb17a9410a1fd22fa93f9a56 (diff) | |
download | volse-hubzilla-b6b4ffa68d6deab233dcda06113a849ac78f8f84.tar.gz volse-hubzilla-b6b4ffa68d6deab233dcda06113a849ac78f8f84.tar.bz2 volse-hubzilla-b6b4ffa68d6deab233dcda06113a849ac78f8f84.zip |
add curl error text to mod/probe so we can remotely diagnose communication issues from other sites.
-rw-r--r-- | include/network.php | 6 | ||||
-rw-r--r-- | mod/probe.php | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/include/network.php b/include/network.php index 27f912508..7fc3d835e 100644 --- a/include/network.php +++ b/include/network.php @@ -115,8 +115,9 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { $ret['return_code'] = $rc; $ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false); if(! $ret['success']) { + $ret['error'] = curl_error($ch); $ret['debug'] = $curl_info; - logger('z_fetch_url: error:' . curl_error($ch), LOGGER_DEBUG); + logger('z_fetch_url: error:' . $ret['error'], LOGGER_DEBUG); logger('z_fetch_url: debug:' . print_r($curl_info,true), LOGGER_DATA); } $ret['body'] = substr($s,strlen($header)); @@ -218,8 +219,9 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { $ret['return_code'] = $rc; $ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false); if(! $ret['success']) { + $ret['error'] = curl_error($ch); $ret['debug'] = $curl_info; - logger('z_post_url: error:' . curl_error($ch), LOGGER_DEBUG); + logger('z_post_url: error:' . $ret['error'], LOGGER_DEBUG); logger('z_post_url: debug:' . print_r($curl_info,true), LOGGER_DATA); } diff --git a/mod/probe.php b/mod/probe.php index e2dd4ef77..5b226cb6a 100644 --- a/mod/probe.php +++ b/mod/probe.php @@ -20,10 +20,14 @@ function probe_content(&$a) { if($res['success']) $j = json_decode($res['body'],true); else { + $o .= sprintf( t('Fetching URL returns error: $1%s'),$res['error'] . "\r\n\r\n"); $o .= "<strong>https connection failed. Trying again with auto failover to http.</strong>\r\n\r\n"; $res = zot_finger($addr,$channel,true); if($res['success']) $j = json_decode($res['body'],true); + else + $o .= sprintf( t('Fetching URL returns error: $1%s'),$res['error'] . "\r\n\r\n"); + } if($j && $j['permissions'] && $j['permissions']['iv']) $j['permissions'] = json_decode(crypto_unencapsulate($j['permissions'],$channel['channel_prvkey']),true); |