tweak HTTP transport defaults - twitch-go - twitch.tv web application in Go
(HTM) git clone git://git.codemadness.org/twitch-go
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ce4781ef15eb2330b793db45629d223a7e294b98
(DIR) parent 311de01e329f82c99ea58ace5498a03f1725c6db
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 6 Apr 2019 20:38:24 +0200
tweak HTTP transport defaults
Diffstat:
M src/twitch/twitch.go | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/src/twitch/twitch.go b/src/twitch/twitch.go
@@ -141,8 +141,15 @@ type Videos struct {
}
func ReadAllUrl(url string) ([]byte, error) {
+ tr := &http.Transport{
+ DisableCompression: true,
+ DisableKeepAlives: true,
+ MaxIdleConns: 4,
+ IdleConnTimeout: 30 * time.Second,
+ }
client := http.Client{
- Timeout: time.Duration(30) * time.Second,
+ Timeout: time.Duration(30) * time.Second,
+ Transport: tr,
}
req, err := http.NewRequest("GET", url, nil)
if err != nil {