fix(clone): give cloned collector its own redirect handler#904
Open
Noethix55555 wants to merge 1 commit into
Open
fix(clone): give cloned collector its own redirect handler#904Noethix55555 wants to merge 1 commit into
Noethix55555 wants to merge 1 commit into
Conversation
Clone shared the parent's httpBackend, whose http.Client CheckRedirect closure was bound to the parent collector. A clone's AllowURLRevisit, filters and store were therefore ignored when following redirects. Give the clone its own httpBackend and http.Client that reuse the parent's Transport, cookie jar, timeout and limit rules, but rebind CheckRedirect to the clone.
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.
Fixes #875
Cloneshared the parent'shttpBackend, which holds a single*http.Client. That client'sCheckRedirectclosure is created inInitand bound to the parent collector. Consequently, when a clone followed a redirect, the redirect check ran against the parent'sAllowURLRevisit,AllowedDomains/DisallowedDomains,DisallowedURLFiltersandstoreinstead of the clone's.This gives the clone its own
httpBackendandhttp.Clientthat reuse the parent'sTransport, cookie jar, timeout and limit rules (so connection pooling and cookies still behave as documented), but rebindsCheckRedirectto the clone viaclone.checkRedirectFunc().Regression test: parent has no filters; clone sets
DisallowedURLFiltersto block/blocked; server redirects/a-> 302 ->/blocked. The clone must not follow the redirect. The test fails on master (the clone reaches/blocked) and passes with the fix. Full suite and-racepass.