Digest auth: reuse challenges across requests (#32842)
This commit is contained in:
parent
37d8aecbb2
commit
c28f2ff623
8 changed files with 247 additions and 17 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue