retry-https considered harmful: use original result when retry-https encounters an error #357
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.
Use original result when retry-https encounters an error
How to Test
Start with retry-https disable and find a page that redirects to a SSO page -> get a nice "Too many redirects" error.
Now enable retry-https and rescan -> you should still get the "Too many redirects" error, not a timeout or "tls oversized record received with length 20527"
Notes & Caveats
Currently, whenever any error is encountered and retry-https is enabled, the original, often still useful error is thrown away and instead you get either timeouts or "tls oversized record received with length 20527" when it fails, too. Especially with errors like "Too many redirects", which still can be useful given that the body and HTTP headers are still included, this retry behavior is infuriating and harmful at best, given that the retry error usually is super useless unless this port actually uses HTTPS.
Therefore, let's keep the original error when retry-https fails too, and only use retry-https' result when it actually succeeds.