Skip to content

Commit

Permalink
add timeouts on TLSHandshake and ResponseHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
zenovich committed Feb 21, 2017
1 parent e60247e commit d90e1c7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package httpstream
import (
"bufio"
"bytes"
"crypto/tls"
"encoding/base64"
"errors"
"io"
Expand All @@ -22,7 +23,6 @@ import (
"sync"
"time"

"crypto/tls"
"github.com/mrjones/oauth"
)

Expand Down Expand Up @@ -77,11 +77,13 @@ func basicauthConnect(conn *streamConn) (*http.Response, error) {
}

conn.client = &http.Client{}
httpTransport := &http.Transport{}
if conn.insecure {
conn.client.Transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
httpTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
httpTransport.TLSHandshakeTimeout = 30 * time.Second
httpTransport.ResponseHeaderTimeout = 30 * time.Second
conn.client.Transport = httpTransport

var req http.Request
req.URL = conn.url
Expand Down

0 comments on commit d90e1c7

Please sign in to comment.