File: b2_go17.go

package info (click to toggle)
golang-github-filosottile-b2 0.0~git20170207.b197f7a-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 124 kB
  • sloc: makefile: 84
file content (21 lines) | stat: -rw-r--r-- 397 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// +build go1.7

package b2

import (
	"net/http"
	"net/http/httptrace"
)

func addTracing(req *http.Request) *http.Request {
	trace := &httptrace.ClientTrace{
		ConnectStart: func(network, addr string) {
			debugf("new connection to %s (for %s)", addr, req.URL.Path)
		},
	}
	return req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
}

func init() {
	requestExtFunc = addTracing
}