Digest auth: reuse challenges across requests (#32842)

This commit is contained in:
andig 2026-08-21 17:32:25 +02:00 • committed by GitHub
parent 37d8aecbb2
commit c28f2ff623
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 247 additions and 17 deletions

View file

@ -29,7 +29,6 @@ import (
"github.com/evcc-io/evcc/util/request"
"github.com/evcc-io/evcc/util/sponsor"
"github.com/evcc-io/evcc/util/transport"
"github.com/jpfielding/go-http-digest/pkg/digest"
)
// ShellyTopAC charger implementation for Shelly Top AC Portable EV Charger
@ -82,7 +81,7 @@ func NewShellyTopAC(uri, user, password string) (api.Charger, error) {
// Setup digest authentication for Shelly Gen2
if user != "" {
c.Client.Transport = digest.NewTransport(user, password, c.Client.Transport)
c.Client.Transport = transport.Digest(user, password, c.Client.Transport)
}
// Setup cached status getters

View file

@ -5,7 +5,7 @@ import (
"github.com/evcc-io/evcc/util"
"github.com/evcc-io/evcc/util/request"
"github.com/jpfielding/go-http-digest/pkg/digest"
"github.com/evcc-io/evcc/util/transport"
)
type Connection struct {
@ -24,7 +24,7 @@ func NewConnection(log *util.Logger, uri, user, pass string) *Connection {
}
if c.Username != "" && c.Password != "" {
c.Client.Transport = digest.NewTransport(c.Username, c.Password, c.Client.Transport)
c.Client.Transport = transport.Digest(c.Username, c.Password, c.Client.Transport)
}
return c