fix directory constructor option broken since async refactor - #82
Draft
toddr-bot wants to merge 1 commit into
Draft
fix directory constructor option broken since async refactor#82toddr-bot wants to merge 1 commit into
toddr-bot wants to merge 1 commit into
Conversation
The 'directory' option to new() was documented and stored in
$self->{'_directory'} but _get_directory() always fetched from
the server using the separate '_directory_cache' field. Before
the async refactor, both used '_directory' and the option worked.
Now _get_directory() checks for a pre-supplied directory hash
before falling back to the HTTP fetch. The hash is consumed
(deleted) on first use so it doesn't leak into the cache path.
Also removes incorrect 'directory' usage from the certificate
guard test (was passing a string instead of a hashref, masked
by the bug).
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.
What
Restores the
directoryconstructor option forNet::ACME2->new(), which has been silently broken since the async refactor.Why
The original code used
$self->{'_directory'}as both the user-supplied cache seed and the fetched directory cache. During the async refactor,_get_directory()was changed to use a new_directory_cachefield, but_directorywas never connected to it — making the documenteddirectoryoption a no-op.How
_get_directory()now checks for a pre-supplied$self->{'_directory'}before falling back to the HTTP fetch. The hash is consumed (delete) on first use, and the nonce URL is extracted and set just as it would be from a server response.Also removes incorrect
directoryusage fromt/Net-ACME2-get-certificate-guard.t(was passing a string path instead of a hashref, masked by the bug).Testing
t/Net-ACME2-directory-cache.twith 3 subtests:newNoncein directory hash throwsQuality Report
Changes: 4 files changed, 141 insertions(+), 14 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan