1 // Package cleanhttp offers convenience utilities for acquiring "clean" 2 // http.Transport and http.Client structs. 3 // 4 // Values set on http.DefaultClient and http.DefaultTransport affect all 5 // callers. This can have detrimental effects, esepcially in TLS contexts, 6 // where client or root certificates set to talk to multiple endpoints can end 7 // up displacing each other, leading to hard-to-debug issues. This package 8 // provides non-shared http.Client and http.Transport structs to ensure that 9 // the configuration will not be overwritten by other parts of the application 10 // or dependencies. 11 // 12 // The DefaultClient and DefaultTransport functions disable idle connections 13 // and keepalives. Without ensuring that idle connections are closed before 14 // garbage collection, short-term clients/transports can leak file descriptors, 15 // eventually leading to "too many open files" errors. If you will be 16 // connecting to the same hosts repeatedly from the same client, you can use 17 // DefaultPooledClient to receive a client that has connection pooling 18 // semantics similar to http.DefaultClient. 19 // 20 package cleanhttp 21