Skip to content

Commit

Permalink
Support http digest calculation that does not follow the rfc specific…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
imroc committed Aug 23, 2023
1 parent bc78220 commit 23dae15
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func (c *credentials) authorize() (string, error) {
func (c *credentials) validateQop() error {
// Currently only supporting auth quality of protection. TODO: add auth-int support
if c.messageQop == "" {
c.messageQop = "auth"
return nil
}
possibleQops := strings.Split(c.messageQop, ", ")
var authSupport bool
Expand Down Expand Up @@ -250,6 +250,9 @@ func (c *credentials) resp() (string, error) {
ha1 := c.ha1()
ha2 := c.ha2()

if len(c.messageQop) == 0 {
return c.h(fmt.Sprintf("%s:%s:%s", ha1, c.nonce, ha2)), nil
}
return c.kd(ha1, fmt.Sprintf("%s:%08x:%s:%s:%s",
c.nonce, c.nc, c.cNonce, c.messageQop, ha2)), nil
}
Expand Down

0 comments on commit 23dae15

Please sign in to comment.