You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Nouamane\AppData\Local\go-build
set GOENV=C:\Users\Nouamane\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Nouamane\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Nouamane\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\Projets\Hello World\Go\monitoring\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\Nouamane\AppData\Local\Temp\go-build681082894=/tmp/go-build -gno-record-gcc-switches
What did you do?
package main
import (
"context""log""net/http""net/http/httptrace""time"
)
funcmain() {
req, err:=http.NewRequest(http.MethodGet, "https://www.google.com", nil)
iferr!=nil {
log.Fatalf("unable to create request: %v", err)
}
for {
trace:=&httptrace.ClientTrace{
ConnectStart: func(_, _string) {
println("this should be printed infinitely but it doesn't")
},
}
req=req.WithContext(httptrace.WithClientTrace(context.Background(), trace))
client:=&http.Client{
// Transport: &http.Transport{}, // when we uncomment this line it works fine
}
_, err:=client.Do(req)
iferr!=nil {
log.Fatalf("failed to read response: %v", err)
}
time.Sleep(2)
}
}
What did you expect to see?
Infinite logs
this should be printed infinitely
this should be printed infinitely
this should be printed infinitely
this should be printed infinitely
...
What did you see instead?
I get only one line of log
this should be printed infinitely
I don't understand why the DefaultTransport behaves differently.
The text was updated successfully, but these errors were encountered:
toothrot
changed the title
Successive HTTP requests call trace function only once when using DefaultTransport
x/net/http/httptrace: Successive HTTP requests call trace function only once when using DefaultTransport
Jan 27, 2021
toothrot
changed the title
x/net/http/httptrace: Successive HTTP requests call trace function only once when using DefaultTransport
net/http/httptrace: Successive HTTP requests call trace function only once when using DefaultTransport
Jan 27, 2021
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Infinite logs
What did you see instead?
I get only one line of log
I don't understand why the DefaultTransport behaves differently.
The text was updated successfully, but these errors were encountered: