Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
small optimization: using strings.Contains instead regexp.MatchString
Browse files Browse the repository at this point in the history
  • Loading branch information
reinventer committed Jun 23, 2019
1 parent 12e4990 commit 9d6d311
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"hash"
"io"
"net/url"
"regexp"
"strings"
"time"
)
Expand Down Expand Up @@ -105,7 +104,7 @@ func (ah *authorization) computeA1(dr *DigestRequest) string {

func (ah *authorization) computeA2(dr *DigestRequest) string {

if matched, _ := regexp.MatchString("auth-int", dr.Wa.Qop); matched {
if strings.Contains(dr.Wa.Qop, "auth-int") {
ah.Qop = "auth-int"
return fmt.Sprintf("%s:%s:%s", dr.Method, ah.URI, ah.hash(dr.Body))
}
Expand Down

0 comments on commit 9d6d311

Please sign in to comment.