Repository navigation
Remove unused signature and etag config fields - #86
Merged
Merged
Conversation
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 changes
dims.Request.shrinkFactor. It was set to 1 and then to the shrink factor, and nothing read it. The localshrinkvalue is what reachesimportParams.EtagAlgorithmoffcore.Configonto the request.internal/http.Requestcarries it, and each endpoint sets it in its own constructor. The two private configuration copies inpkg/dims.NewHandlerexisted only to hold this field, so they go too.v4.Request.HashId. See below.Two findings while doing this
The Lambda path never set
EtagAlgorithm.aws.NewRequestpasses the configuration straight through, soConfig().EtagAlgorithmwas empty there andEtag()fell to itselsebranch. A/dims4/request served by Lambda produced a sha256 ETag while the same request served by the binary produced an md5 one. Setting the field in the endpoint constructor fixes it, because both paths use that constructor.v4.Request.HashIdnever ran.Etag()is defined on the embeddedinternal/http.Request, so itsr.HashId()call binds to that type at compile time. Go does not dispatch through embedding, so the v4 override was unreachable and the client id never entered the ETag.It is removed rather than wired up. Wiring it in would change every
/dims4/ETag and invalidate downstream caches, and it buys nothing: two client ids requesting the same commands and image URL get identical response bytes, so they should share an ETag.Verify
TestEtagUsesMd5andTestEtagUsesSha256pin the digest per endpoint. Neither reads the configuration, which no longer carries the field.The ETag output is unchanged for both endpoints. Against an origin that sends
ETag: "origin-etag", before and after this change:go build ./...,go vet, andgo test -race -count=1 ./...pass on the builder image.