use killme() instead of die() so that any sessions are closed cleanly.

This commit is contained in:
redmatrix 2015-12-08 20:42:46 -08:00
parent 5735cad457
commit 656e5fd052

View File

@ -1,6 +1,6 @@
<?php /** @file */ <?php /** @file */
require_once("oauth.php"); require_once('include/oauth.php');
/** /**
@ -25,7 +25,7 @@ function api_login(&$a){
} }
echo __file__.__line__.__function__."<pre>"; echo __file__.__line__.__function__."<pre>";
// var_dump($consumer, $token); // var_dump($consumer, $token);
die(); killme();
} }
catch(Exception $e) { catch(Exception $e) {
logger(__file__.__line__.__function__."\n".$e); logger(__file__.__line__.__function__."\n".$e);
@ -56,7 +56,8 @@ function api_login(&$a){
logger('API_login: ' . print_r($_SERVER,true), LOGGER_DEBUG); logger('API_login: ' . print_r($_SERVER,true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Red"'); header('WWW-Authenticate: Basic realm="Red"');
header('HTTP/1.0 401 Unauthorized'); header('HTTP/1.0 401 Unauthorized');
die('This api requires login'); echo('This api requires login');
killme();
} }
// process normal login request // process normal login request
@ -81,7 +82,8 @@ function api_login(&$a){
logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG); logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Red"'); header('WWW-Authenticate: Basic realm="Red"');
header('HTTP/1.0 401 Unauthorized'); header('HTTP/1.0 401 Unauthorized');
die('This api requires login'); echo('This api requires login');
killme();
} }
} }