Skip to content

Commit

Permalink
use default http client everywhere now since we're not modifying it
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhodges committed Sep 4, 2024
1 parent b91d6ce commit 5ab08d2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion signer/contentsignaturepki/contentsignature.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"hash"
"io"
"math/big"
"net/http"
"time"

"github.com/mozilla-services/autograph/database"
Expand Down Expand Up @@ -187,7 +188,7 @@ func (s *ContentSigner) initEE(conf signer.Configuration) error {
default:
return fmt.Errorf("contentsignaturepki %q: failed to find suitable end-entity: %w", s.ID, err)
}
_, _, err = GetX5U(buildHTTPClient(), s.X5U)
_, _, err = GetX5U(http.DefaultClient, s.X5U)
if err != nil {
return fmt.Errorf("contentsignaturepki %q: failed to verify x5u: %w", s.ID, err)
}
Expand Down
3 changes: 2 additions & 1 deletion signer/contentsignaturepki/contentsignature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package contentsignaturepki
import (
"crypto/ecdsa"
"fmt"
"net/http"
"strings"
"testing"

Expand Down Expand Up @@ -74,7 +75,7 @@ func TestSign(t *testing.T) {
}

// verify the signature using the public key of the end entity
_, certs, err := GetX5U(buildHTTPClient(), s.X5U)
_, certs, err := GetX5U(http.DefaultClient, s.X5U)
if err != nil {
t.Fatalf("testcase %d failed to get X5U %q: %v", i, s.X5U, err)
}
Expand Down
5 changes: 0 additions & 5 deletions signer/contentsignaturepki/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ func writeLocalFile(data, name string, target *url.URL) error {
return os.WriteFile(filepath.Join(target.Path, name), []byte(data), 0755)
}

// buildHTTPClient returns the default HTTP.Client for fetching X5Us
func buildHTTPClient() *http.Client {
return &http.Client{}
}

// GetX5U retrieves a chain file of certs from upload location, parses
// and verifies it, then returns a byte slice of the response body and
// a slice of parsed certificates.
Expand Down
3 changes: 2 additions & 1 deletion signer/contentsignaturepki/x509.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/pem"
"fmt"
"math/big"
"net/http"
"net/url"
"time"

Expand Down Expand Up @@ -55,7 +56,7 @@ func (s *ContentSigner) makeAndUploadChain() error {
if err != nil {
return fmt.Errorf("failed to join x5u with chain name: %w", err)
}
_, _, err = GetX5U(buildHTTPClient(), newX5U)
_, _, err = GetX5U(http.DefaultClient, newX5U)
if err != nil {
return fmt.Errorf("failed to download new chain: %w", err)
}
Expand Down

0 comments on commit 5ab08d2

Please sign in to comment.