Handle empty TRC&Chain messages in python
In we started to allow empty replies for cache only TRC&Chain requests,
we need to handle this properly in python.
# Copyright 2015 ETH Zurich
+# Copyright 2019 ETH Zurich, Anapaya Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -70,6 +71,8 @@ class CertChainReply(Cerealizable): # pragma: no cover
def __init__(self, p):
super().__init__(p)
+ self.chain = None
+ if p.chain:
self.chain = CertificateChain.from_raw(p.chain, lz4_=True)
@classmethod
@@ -108,6 +111,8 @@ class TRCReply(Cerealizable): # pragma: no cover
def __init__(self, p):
super().__init__(p)
+ self.trc = None
+ if p.trc:
self.trc = TRC.from_raw(p.trc, lz4_=True)
@classmethod
