Deduplicate HTTP Uri ModelLoaders #4352
Merged
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.
Description
This change deduplicates the identical efforts made by
UrlUriLoader
andHttpUriLoader
by deprecatingHttpUriLoader
and removing it from the registry.Fixes #2943
Motivation and Context
Glide had two essentially identical ModelLoaders: UrlUriLoader and HttpUriLoader. They both were being used to defer HTTP/HTTPS Uris to another ModelLoader.
Best-case scenario, this was a harmless distraction; but in some bad cases, it was possible for both ModelLoaders to fire, duplicating work.
With this change, only one of the two HTTP Uri ModelLoaders are entered into the registry. The one no longer being used has been deprecated as well.
I chose to deprecate HttpUriLoader because it can be implemented as a UrlUriLoader (but not vice versa, due to generics). To demonstrate that it still behaves the same, the test (which now targets UrlUriLoader) is unchanged but still passes.
Note
This PR was originally opened as #4316 but went stale while I was on vacation. I've rebased onto the latest
master
and am more than happy to work with maintainers to figure out how to get this merged (if this fix is desired).