1// +build go1.7 go1.8
2
3/*
4 * Minio Go Library for Amazon S3 Compatible Cloud Storage
5 * Copyright 2017-2018 Minio, Inc.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20package minio
21
22import (
23	"net"
24	"net/http"
25	"time"
26)
27
28// DefaultTransport - this default transport is similar to
29// http.DefaultTransport but with additional param  DisableCompression
30// is set to true to avoid decompressing content with 'gzip' encoding.
31var DefaultTransport http.RoundTripper = &http.Transport{
32	Proxy: http.ProxyFromEnvironment,
33	DialContext: (&net.Dialer{
34		Timeout:   30 * time.Second,
35		KeepAlive: 30 * time.Second,
36		DualStack: true,
37	}).DialContext,
38	MaxIdleConns:          100,
39	MaxIdleConnsPerHost:   100,
40	IdleConnTimeout:       90 * time.Second,
41	TLSHandshakeTimeout:   10 * time.Second,
42	ExpectContinueTimeout: 1 * time.Second,
43	// Set this value so that the underlying transport round-tripper
44	// doesn't try to auto decode the body of objects with
45	// content-encoding set to `gzip`.
46	//
47	// Refer:
48	//    https://golang.org/src/net/http/transport.go?h=roundTrip#L1843
49	DisableCompression: true,
50}
51