Adds timeout to tls for gemini and increases gopher timeout

This commit is contained in:
Sloom Sloum Sluom IV 2020-06-29 21:45:24 -07:00
parent bc38cb8fb5
commit 80bdbb642d
2 changed files with 4 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import (
"crypto/tls"
"fmt"
"io/ioutil"
"net"
"net/url"
"strconv"
"strings"
@ -26,6 +27,7 @@ type TofuDigest struct {
}
var BlockBehavior = "block"
var TlsTimeout = time.Duration(15) * time.Second
//------------------------------------------------\\
// + + + 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
}
conn, err := tls.Dial("tcp", addr, conf)
conn, err := tls.DialWithDialer(&net.Dialer{Timeout: TlsTimeout}, "tcp", addr, conf)
if err != nil {
return "", fmt.Errorf("TLS Dial Error: %s", err.Error())
}

View File

@ -49,7 +49,7 @@ var types = map[string]string{
// be better.
func Retrieve(host, port, resource string) ([]byte, error) {
nullRes := make([]byte, 0)
timeOut := time.Duration(5) * time.Second
timeOut := time.Duration(15) * time.Second
if host == "" || port == "" {
return nullRes, errors.New("Incomplete request url")