Skip to content

Commit

Permalink
wip: add slices back to fix the overwrite issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nickajacks1 committed Oct 20, 2023
1 parent 55b5d6d commit 21b4393
Showing 1 changed file with 35 additions and 8 deletions.
43 changes: 35 additions & 8 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,26 +289,53 @@ func acceptsOfferType(spec, offerType string, specParams headerParams) bool {
// See https://www.rfc-editor.org/rfc/rfc9110#name-parameters
func paramsMatch(specParams headerParams, offerParams string) bool {
stillOk := true
messi := make([][2]string, 0, 2)
forHold(string(specParams), func(s1, s2 string) bool {
if s1 == "q" || s1 == "Q" {
return false
}
for i := range messi {
if utils.EqualFold(s1, messi[i][0]) {
messi[i][1] = s2
return false
}
}
messi = append(messi, [2]string{s1, s2})
// messi[s1] = s2
return true
})
for i := range messi {
foundKey := false
forHold(offerParams, func(offerParam, offerVal string) bool {
if utils.EqualFold(s1, offerParam) {
if utils.EqualFold(messi[i][0], offerParam) {
foundKey = true
stillOk = utils.EqualFold(s2, offerVal)
stillOk = utils.EqualFold(messi[i][1], offerVal)
return false
}
return true
})
if !foundKey {
stillOk = false
if !foundKey || !stillOk {
return false
}
return stillOk
})
// for _, specParam := range specParams {
// }
}
// forHold(string(specParams), func(s1, s2 string) bool {
// if s1 == "q" || s1 == "Q" {
// return false
// }
// foundKey := false
// forHold(offerParams, func(offerParam, offerVal string) bool {
// if utils.EqualFold(s1, offerParam) {
// foundKey = true
// stillOk = utils.EqualFold(s2, offerVal)
// return false
// }
// return true
// })
// if !foundKey {
// stillOk = false
// }
// return stillOk
// })
return stillOk
}

Expand Down

0 comments on commit 21b4393

Please sign in to comment.