in probe diagnostic - note https failure as diagnostic info - this also changes zot_finger so you can tell it not to fallback. This could be useful in corporate environments that are off the grid or other high security situations (as much as anything could be considered high security which relies on SSL).
This commit is contained in:
parent
bde20f81e6
commit
494090a3b7
@ -116,7 +116,7 @@ function zot_zot($url,$data) {
|
||||
*/
|
||||
|
||||
|
||||
function zot_finger($webbie,$channel) {
|
||||
function zot_finger($webbie,$channel,$autofallback = true) {
|
||||
|
||||
|
||||
if(strpos($webbie,'@') === false) {
|
||||
@ -165,7 +165,7 @@ function zot_finger($webbie,$channel) {
|
||||
$result = z_post_url($url . $rhs,$postvars);
|
||||
|
||||
|
||||
if(! $result['success']) {
|
||||
if((! $result['success']) && ($autofallback)) {
|
||||
if($https) {
|
||||
logger('zot_finger: https failed. falling back to http');
|
||||
$result = z_post_url('http://' . $host . $rhs,$postvars);
|
||||
@ -176,7 +176,7 @@ function zot_finger($webbie,$channel) {
|
||||
$rhs .= '?f=&address=' . urlencode($address);
|
||||
|
||||
$result = z_fetch_url($url . $rhs);
|
||||
if(! $result['success']) {
|
||||
if((! $result['success']) && ($autofallback)) {
|
||||
if($https) {
|
||||
logger('zot_finger: https failed. falling back to http');
|
||||
$result = z_fetch_url('http://' . $host . $rhs);
|
||||
|
@ -15,9 +15,16 @@ function probe_content(&$a) {
|
||||
if(x($_GET,'addr')) {
|
||||
$channel = $a->get_channel();
|
||||
$addr = trim($_GET['addr']);
|
||||
$res = zot_finger($addr,$channel);
|
||||
$res = zot_finger($addr,$channel,false);
|
||||
$o .= '<pre>';
|
||||
$j = json_decode($res['body'],true);
|
||||
if($res['success'])
|
||||
$j = json_decode($res['body'],true);
|
||||
else {
|
||||
$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);
|
||||
}
|
||||
if($j && $j['permissions'] && $j['permissions']['iv'])
|
||||
$j['permissions'] = json_decode(aes_unencapsulate($j['permissions'],$channel['channel_prvkey']),true);
|
||||
$o .= str_replace("\n",'<br />',print_r($j,true));
|
||||
|
Reference in New Issue
Block a user