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

http.ListenAndServe handler function called twice when using port 80 #22673

Closed
petergloor opened this issue Nov 11, 2017 · 1 comment
Closed

Comments

@petergloor
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.9.2 windows/amd64 (where I analyzed and tested the problem)
go version go1.9.1 linux/amd64 (where I first detected the problem)

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

windows / amd64

What did you do?

Changed the port # from 8080 to 80 in the following example.

https://play.golang.org/p/96H7CauyUM

What did you expect to see?

Independent of the port number I expected the count to be increased by one per request.

What did you see instead?

While the count is increased by one per request using port 8080 it is increased twice per request using port 80. It looks like the handler function is being called twice.

main.go.txt
console_output.txt

@petergloor
Copy link
Author

It's not a Go issue. The browser is requesting favicon.ico and that's also handled by the default handler. Just learned my lesson so ;).

@golang golang locked and limited conversation to collaborators Nov 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants