diff options
Diffstat (limited to 'cautious_http_client.go')
-rw-r--r-- | cautious_http_client.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/cautious_http_client.go b/cautious_http_client.go index 66179f2..2f33ae0 100644 --- a/cautious_http_client.go +++ b/cautious_http_client.go | |||
@@ -2,6 +2,7 @@ package main | |||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "encoding/json" | 4 | "encoding/json" |
5 | "fmt" | ||
5 | "net" | 6 | "net" |
6 | "net/http" | 7 | "net/http" |
7 | "net/url" | 8 | "net/url" |
@@ -28,9 +29,9 @@ func NewCautiousHTTPClient() CautiousHTTPClient { | |||
28 | }).DialContext, | 29 | }).DialContext, |
29 | MaxIdleConns: 100, | 30 | MaxIdleConns: 100, |
30 | IdleConnTimeout: 90 * time.Second, | 31 | IdleConnTimeout: 90 * time.Second, |
31 | TLSHandshakeTimeout: 3 * time.Second, | 32 | TLSHandshakeTimeout: 1 * time.Second, |
32 | ExpectContinueTimeout: 1 * time.Second, | 33 | ExpectContinueTimeout: 1 * time.Second, |
33 | ResponseHeaderTimeout: 5 * time.Second, | 34 | ResponseHeaderTimeout: 10 * time.Second, |
34 | MaxResponseHeaderBytes: 500000, // .5 MB | 35 | MaxResponseHeaderBytes: 500000, // .5 MB |
35 | } | 36 | } |
36 | 37 | ||
@@ -49,11 +50,9 @@ func (c *cautiousHttpClient) Get(gurl string) (*http.Response, error) { | |||
49 | } | 50 | } |
50 | 51 | ||
51 | // TODO | 52 | // TODO |
52 | /* | 53 | if u.Scheme != "https" && false { |
53 | if u.Scheme != "https" { | 54 | return nil, fmt.Errorf("URL for GET must be secure") |
54 | return nil, fmt.Errorf("URL for GET must be secure") | 55 | } |
55 | } | ||
56 | */ | ||
57 | 56 | ||
58 | r, err := c.client.Get(u.String()) | 57 | r, err := c.client.Get(u.String()) |
59 | if err != nil { | 58 | if err != nil { |