forked from FiloSottile/b2
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take the occasion to move Authorization into the RoundTripper. Use build tags to only enable httptrace on Go 1.7.
- Loading branch information
1 parent
0272537
commit 6a0843a
Showing
4 changed files
with
86 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters