aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/network.php b/include/network.php
index d41ba198d..a5c14f9d1 100644
--- a/include/network.php
+++ b/include/network.php
@@ -423,7 +423,7 @@ function json_return_and_die($x, $content_type = 'application/json') {
killme();
}
-function as_return_and_die($obj, $channel) {
+function as_return_and_die($obj, $channel = []) {
$ret = Activity::build_packet($obj, $channel);
logger('data: ' . jindent($ret), LOGGER_DATA);
@@ -433,8 +433,10 @@ function as_return_and_die($obj, $channel) {
$headers['Digest'] = HTTPSig::generate_digest_header($ret);
$headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
- $h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel));
- HTTPSig::set_headers($h);
+ if ($channel) {
+ $h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel));
+ HTTPSig::set_headers($h);
+ }
echo $ret;
killme();