forked from sloum/bombadillo
Adds timeout to tls for gemini and increases gopher timeout
This commit is contained in:
parent
bc38cb8fb5
commit
80bdbb642d
|
@ -6,6 +6,7 @@ import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -26,6 +27,7 @@ type TofuDigest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var BlockBehavior = "block"
|
var BlockBehavior = "block"
|
||||||
|
var TlsTimeout = time.Duration(15) * time.Second
|
||||||
|
|
||||||
//------------------------------------------------\\
|
//------------------------------------------------\\
|
||||||
// + + + R E C E I V E R S + + + \\
|
// + + + R E C E I V E R S + + + \\
|
||||||
|
@ -189,7 +191,7 @@ func Retrieve(host, port, resource string, td *TofuDigest) (string, error) {
|
||||||
return &td.ClientCert, nil
|
return &td.ClientCert, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
conn, err := tls.Dial("tcp", addr, conf)
|
conn, err := tls.DialWithDialer(&net.Dialer{Timeout: TlsTimeout}, "tcp", addr, conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("TLS Dial Error: %s", err.Error())
|
return "", fmt.Errorf("TLS Dial Error: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ var types = map[string]string{
|
||||||
// be better.
|
// be better.
|
||||||
func Retrieve(host, port, resource string) ([]byte, error) {
|
func Retrieve(host, port, resource string) ([]byte, error) {
|
||||||
nullRes := make([]byte, 0)
|
nullRes := make([]byte, 0)
|
||||||
timeOut := time.Duration(5) * time.Second
|
timeOut := time.Duration(15) * time.Second
|
||||||
|
|
||||||
if host == "" || port == "" {
|
if host == "" || port == "" {
|
||||||
return nullRes, errors.New("Incomplete request url")
|
return nullRes, errors.New("Incomplete request url")
|
||||||
|
|
Loading…
Reference in New Issue