Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: dubious code in TestServeMuxHandlerRedirects #18068

Closed
dominikh opened this issue Nov 28, 2016 · 3 comments
Closed

net/http: dubious code in TestServeMuxHandlerRedirects #18068

dominikh opened this issue Nov 28, 2016 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@dominikh
Copy link
Member

The test TestServeMuxHandlerRedirects in net/http/serve_test.go looks dubious. The for tries > 0 loop will execute exactly once – tries starts at 1, gets decremented once at the bottom of the loop, and there is no path that would skip the decrement and execute the loop again. Similarly, the check if tries < 0 can never be true – tries will either be its initial value of 1, or the once-decremented value 0.

/cc @bradfitz

@bradfitz
Copy link
Contributor

@minux, looks like you wrote this code over three years ago in 716a409

You want to take a look?

@bradfitz bradfitz added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure. labels Nov 28, 2016
@bradfitz bradfitz added this to the Go1.9 milestone Nov 28, 2016
@bradfitz
Copy link
Contributor

Marking Go 1.9, but Go 1.8 is fine too if somebody wants to look into it.

@gopherbot
Copy link

CL https://golang.org/cl/33654 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 30, 2017
@rsc rsc unassigned minux Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

4 participants