| 1 |
Source: golang-github-hashicorp-go-cleanhttp |
| 2 |
Maintainer: Debian Go Packaging Team <[email protected]> |
| 3 |
Uploaders: Tianon Gravi <[email protected]>, |
| 4 |
Tim Potter <[email protected]>, |
| 5 |
Anthony Fok <[email protected]>, |
| 6 |
Dmitry Smirnov <[email protected]>, |
| 7 |
Section: golang |
| 8 |
Testsuite: autopkgtest-pkg-go |
| 9 |
Priority: optional |
| 10 |
Build-Depends: debhelper-compat (= 13), |
| 11 |
dh-golang, |
| 12 |
golang-any |
| 13 |
Standards-Version: 4.5.1 |
| 14 |
Vcs-Browser: https://salsa.debian.org/go-team/packages/golang-github-hashicorp-go-cleanhttp |
| 15 |
Vcs-Git: https://salsa.debian.org/go-team/packages/golang-github-hashicorp-go-cleanhttp.git |
| 16 |
Homepage: https://github.com/hashicorp/go-cleanhttp |
| 17 |
Rules-Requires-Root: no |
| 18 |
XS-Go-Import-Path: github.com/hashicorp/go-cleanhttp |
| 19 |
|
| 20 |
Package: golang-github-hashicorp-go-cleanhttp-dev |
| 21 |
Architecture: all |
| 22 |
Multi-Arch: foreign |
| 23 |
Depends: ${misc:Depends}, |
| 24 |
${shlibs:Depends} |
| 25 |
Description: Functions for accessing "clean" Go http.Client values |
| 26 |
The Go standard library contains a default http.Client called |
| 27 |
http.DefaultClient. It is a common idiom in Go code to start with |
| 28 |
http.DefaultClient and tweak it as necessary, and in fact, this is encouraged; |
| 29 |
from the http package documentation: |
| 30 |
. |
| 31 |
The Client's Transport typically has internal state (cached TCP connections), |
| 32 |
so Clients should be reused instead of created as needed. Clients are safe |
| 33 |
for concurrent use by multiple goroutines. |
| 34 |
. |
| 35 |
Unfortunately, this is a shared value, and it is not uncommon for libraries to |
| 36 |
assume that they are free to modify it at will. With enough dependencies, it |
| 37 |
can be very easy to encounter strange problems and race conditions due to |
| 38 |
manipulation of this shared value across libraries and goroutines (clients are |
| 39 |
safe for concurrent use, but writing values to the client struct itself is not |
| 40 |
protected). |
| 41 |
. |
| 42 |
Making things worse is the fact that a bare http.Client will use a default |
| 43 |
http.Transport called http.DefaultTransport, which is another global value that |
| 44 |
behaves the same way. So it is not simply enough to replace http.DefaultClient |
| 45 |
with &http.Client{}. |
| 46 |
. |
| 47 |
This repository provides some simple functions to get a "clean" http.Client -- |
| 48 |
one that uses the same default values as the Go standard library, but returns a |
| 49 |
client that does not share any state with other clients. |
| 50 |
. |
| 51 |
This package contains the source. |