Correct handling of Void response_bytes in OCSP #290
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
response_bytes
is optional, thusVoid
when omitted, which happens with some statuses (like 'unauthorized'). Make all properties return correct values in this case:None
for everything exceptcritical_extensions
which is the empty set.I wrote it with a guard that causes the indent to increase - could be rewritten as
if early return and repeating
self._processed_extensions = True
is deemed less bothersome than the increased indent.The simple ternary operator fix for
basic_ocsp_response
andresponse_data
may not be enough for every case as there are several more layers of unwrapping that need to be error-free, but looking at #246 and #262 this should fix theTypeError
although user code will (still) have to check forNone
but the docstrings always indicated that possibility.The test code I didn't write might include this - it's what a real 'unauthorized' response looks like (I got it from Let's Encrypt when querying an expired cert)
Yes, that short: a sequence with an enumerated '6' value, and the
response_bytes
is completely omitted.