|
|
@ -18,7 +18,7 @@ import ( |
|
|
|
var userAgent = "go application" |
|
|
|
var userAgent = "go application" |
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
var ( |
|
|
|
dialTimeout = flag.Duration("dial_timeout", 5*time.Second, "Timeout for dialing an HTTP connection.") |
|
|
|
dialTimeout = flag.Duration("dial_timeout", 30*time.Second, "Timeout for dialing an HTTP connection.") |
|
|
|
readTimeout = flag.Duration("read_timeout", 10*time.Second, "Timeoout for reading an HTTP response.") |
|
|
|
readTimeout = flag.Duration("read_timeout", 10*time.Second, "Timeoout for reading an HTTP response.") |
|
|
|
writeTimeout = flag.Duration("write_timeout", 5*time.Second, "Timeout writing an HTTP request.") |
|
|
|
writeTimeout = flag.Duration("write_timeout", 5*time.Second, "Timeout writing an HTTP request.") |
|
|
|
) |
|
|
|
) |
|
|
@ -77,6 +77,7 @@ func httpGet(client *http.Client, url string, header http.Header) (io.ReadCloser |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, &RemoteError{req.URL.Host, err} |
|
|
|
return nil, &RemoteError{req.URL.Host, err} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if resp.StatusCode == 200 { |
|
|
|
if resp.StatusCode == 200 { |
|
|
|
return resp.Body, nil |
|
|
|
return resp.Body, nil |
|
|
|
} |
|
|
|
} |
|
|
|