mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 15:55:13 +00:00
http-signature fixes from upstream - preserve (request-target) from original gateway request prior to redirection
This commit is contained in:
parent
c36de06026
commit
75148b984f
4 changed files with 5 additions and 4 deletions
2
boot.php
2
boot.php
|
@ -166,7 +166,7 @@ class App {
|
|||
private static $widgets = []; // widgets for this page
|
||||
public static $config = []; // config cache
|
||||
public static $icon = '';
|
||||
|
||||
public static $originalRequest;
|
||||
public static $override_intltext_templates = [];
|
||||
public static $override_markup_templates = [];
|
||||
public static $override_templateroot = null;
|
||||
|
|
|
@ -62,7 +62,7 @@ function as_return_and_die($obj, $channel, $contextType = null, $signObject = tr
|
|||
logger('data: ' . jindent($json), LOGGER_DATA);
|
||||
$headers['Date'] = Time::convert('UTC', 'UTC', 'now', 'D, d M Y H:i:s \\G\\M\\T');
|
||||
$headers['Digest'] = HTTPSig::generate_digest_header($json);
|
||||
$headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
|
||||
$headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . (App::$originalRequest ?? $_SERVER['REQUEST_URI']);
|
||||
|
||||
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::keyId($channel));
|
||||
HTTPSig::set_headers($h);
|
||||
|
|
|
@ -16,7 +16,7 @@ class Apgateway extends Controller
|
|||
|
||||
public function init()
|
||||
{
|
||||
|
||||
App::$originalRequest = '/' . $_REQUEST['req'];
|
||||
// Concatenate path components starting with argv(1)
|
||||
// to isolate the DID URL.
|
||||
$url = null;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Code\Web;
|
||||
|
||||
use App;
|
||||
use Code\Lib\ActorId;
|
||||
use Code\Lib\Time;
|
||||
use DateTime;
|
||||
|
@ -67,7 +68,7 @@ class HTTPSig
|
|||
$headers['(request-target)'] = $data['request_target'];
|
||||
} else {
|
||||
$headers = [];
|
||||
$headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
|
||||
$headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . (App::$originalRequest ?? $_SERVER['REQUEST_URI']);
|
||||
$headers['content-type'] = $_SERVER['CONTENT_TYPE'];
|
||||
$headers['content-length'] = $_SERVER['CONTENT_LENGTH'];
|
||||
|
||||
|
|
Loading…
Reference in a new issue