Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.14 darwin/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="on" GOARCH="amd64" GOBIN="/Users/xx/Documents/develop/go/workspace/bin" GOCACHE="/Users/xx/Library/Caches/go-build" GOENV="/Users/xx/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/xx/Documents/develop/go/workspace" GOPRIVATE="" GOPROXY="direct" GOROOT="/usr/local/go" GOSUMDB="off" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7r/fpcvbc6d32j2lfls0lllcs240000gn/T/go-build785679791=/tmp/go-build -gno-record-gcc-switches -fno-common" GOROOT/bin/go version: go version go1.14 darwin/amd64 GOROOT/bin/go tool compile -V: compile version go1.14 uname -v: Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 ProductName: Mac OS X ProductVersion: 10.15.3 BuildVersion: 19D76 lldb --version: lldb-1100.0.30.12 Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
What did you do?
edit main.go
`package main
import (
"log"
"net/http"
)
func main() {
addr := "127.0.0.1:8080"
http.HandleFunc("/agent", agentHandler)
srv := http.Server{
Addr: addr,
}
srv.SetKeepAlivesEnabled(false)
err := srv.ListenAndServe()
log.Fatal(err)
}
func agentHandler(w http.ResponseWriter, r *http.Request) {
}
`
in terminal1
go run main.go
in terminal2
telnet 127.0.0.1 8080
What did you expect to see?
http server not actively send a tcp keep-alive to client
or i can change time of send tcp keep-alive
What did you see instead?
every 15s, http server actively send a tcp keep-alive to client