Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package gofish
import (
"bytes"
"context"
"crypto/tls"
"encoding/base64"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -121,10 +120,6 @@ func setupClientWithConfig(ctx context.Context, config *ClientConfig) (c *APICli
client.sem = make(chan bool, config.MaxConcurrentRequests)
}

if config.TLSHandshakeTimeout == 0 {
config.TLSHandshakeTimeout = 10
}

if config.HTTPClient == nil {
defaultTransport := http.DefaultTransport.(*http.Transport)
transport := &http.Transport{
Expand All @@ -133,10 +128,20 @@ func setupClientWithConfig(ctx context.Context, config *ClientConfig) (c *APICli
MaxIdleConns: defaultTransport.MaxIdleConns,
IdleConnTimeout: defaultTransport.IdleConnTimeout,
ExpectContinueTimeout: defaultTransport.ExpectContinueTimeout,
TLSClientConfig: defaultTransport.TLSClientConfig,
TLSHandshakeTimeout: time.Duration(config.TLSHandshakeTimeout) * time.Second,
TLSClientConfig: &tls.Config{
InsecureSkipVerify: config.Insecure,
},
}

config.HTTPClient = &http.Client{Transport: transport}
}

client.HTTPClient = config.HTTPClient

// if the provided HTTPClient uses a standard Transport, we want to
// amend its configuration to match what was provided to us
if transport, ok := client.HTTPClient.Transport.(*http.Transport); ok {
if config.Insecure {
transport.TLSClientConfig.InsecureSkipVerify = config.Insecure
}

if config.ReuseConnections {
Expand All @@ -145,12 +150,9 @@ func setupClientWithConfig(ctx context.Context, config *ClientConfig) (c *APICli
transport.IdleConnTimeout = 1 * time.Minute
}

client.HTTPClient = &http.Client{Transport: transport}
} else {
if config.ReuseConnections {
client.keepAlive = true
if config.TLSHandshakeTimeout != 0 {
transport.TLSHandshakeTimeout = time.Duration(config.TLSHandshakeTimeout) * time.Second
}
client.HTTPClient = config.HTTPClient
}

// Fetch the service root
Expand Down
2 changes: 1 addition & 1 deletion redfish/trustedcomponent.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ type TrustedComponent struct {
Status common.Status
// TPM shall contain TPM-specific information for this trusted component. This property shall only be present for
// TCG-defined TPM trusted components.
TPM string
TPM TPM
// TrustedComponentType shall contain the type of trusted component.
TrustedComponentType TrustedComponentType
// UUID shall contain a universally unique identifier number for the trusted component.
Expand Down