Correct handling of Void response_bytes in OCSP#290
Open
geitda wants to merge 1 commit intowbond:masterfrom
Open
Correct handling of Void response_bytes in OCSP#290geitda wants to merge 1 commit intowbond:masterfrom
geitda wants to merge 1 commit intowbond:masterfrom
Conversation
'response_bytes' is optional, thus Void when omitted, which happens with some statuses (like 'unauthorized'). Make all properties return correct values in this case: 'None' for everything except 'critical_extensions' which is the empty set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_bytesis optional, thusVoidwhen omitted, which happens with some statuses (like 'unauthorized'). Make all properties return correct values in this case:Nonefor everything exceptcritical_extensionswhich 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 = Trueis deemed less bothersome than the increased indent.The simple ternary operator fix for
basic_ocsp_responseandresponse_datamay 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 theTypeErroralthough user code will (still) have to check forNonebut 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_bytesis completely omitted.