mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-09 16:24:56 -04:00
SYN-75 sign at the request level rather than the transaction level
This commit is contained in:
parent
cecda27d73
commit
10ef8e6e4b
7 changed files with 70 additions and 52 deletions
|
@ -163,27 +163,15 @@ class TransportLayer(object):
|
|||
if transaction.destination == self.server_name:
|
||||
raise RuntimeError("Transport layer cannot send to itself!")
|
||||
|
||||
if json_data_callback is None:
|
||||
def json_data_callback():
|
||||
return transaction.get_dict()
|
||||
|
||||
# FIXME (erikj): This is a bit of a hack to make the Pdu age
|
||||
# keys work
|
||||
def cb(destination, method, path_bytes, producer):
|
||||
json_data = json_data_callback()
|
||||
del json_data["destination"]
|
||||
del json_data["transaction_id"]
|
||||
producer.reset(json_data)
|
||||
|
||||
# FIXME: This is only used by the tests. The actual json sent is
|
||||
# generated by the json_data_callback.
|
||||
json_data = transaction.get_dict()
|
||||
del json_data["destination"]
|
||||
del json_data["transaction_id"]
|
||||
|
||||
code, response = yield self.client.put_json(
|
||||
transaction.destination,
|
||||
path=PREFIX + "/send/%s/" % transaction.transaction_id,
|
||||
data=json_data,
|
||||
on_send_callback=cb,
|
||||
json_data_callback=json_data_callback,
|
||||
)
|
||||
|
||||
logger.debug(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue