Relax TCP timeouts for koji connections

See COMPOSER-1354 and linked tickets
This commit is contained in:
Diaa Sami 2022-02-09 19:37:32 +01:00 committed by Ondřej Budai
parent 631bd21ffe
commit c1ae5b0881
5 changed files with 47 additions and 45 deletions

View file

@ -1,9 +1,7 @@
package main
import (
"crypto/tls"
"fmt"
"net/http"
"net/url"
"github.com/sirupsen/logrus"
@ -14,17 +12,12 @@ import (
)
type KojiInitJobImpl struct {
KojiServers map[string]koji.GSSAPICredentials
KojiServers map[string]koji.GSSAPICredentials
relaxTimeoutFactor uint
}
func (impl *KojiInitJobImpl) kojiInit(server, name, version, release string) (string, uint64, error) {
// Koji for some reason needs TLS renegotiation enabled.
// Clone the default http transport and enable renegotiation.
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.TLSClientConfig = &tls.Config{
Renegotiation: tls.RenegotiateOnceAsClient,
MinVersion: tls.VersionTLS12,
}
transport := koji.CreateKojiTransport(impl.relaxTimeoutFactor)
serverURL, err := url.Parse(server)
if err != nil {