Lower requirements to go 1.22

This commit is contained in:
WeebDataHoarder
2025-04-04 13:33:47 +02:00
parent c23cea260c
commit 43876c4dd8
3 changed files with 35 additions and 29 deletions

View File

@@ -106,21 +106,27 @@ func (state *State) VerifyChallengeToken(name string, expectedKey []byte, w http
cookie, err := r.Cookie(CookiePrefix + name)
if err != nil {
// fallback: fetch cookie from response
if setCookies, ok := w.Header()["Set-Cookie"]; ok {
for _, setCookie := range setCookies {
newCookie, err := http.ParseSetCookie(setCookie)
if err != nil {
continue
}
// keep processing to find last set cookie
if newCookie.Name == name {
cookie = newCookie
// TODO: implemented in go1.23, port back
/*
if setCookies, ok := w.Header()["Set-Cookie"]; ok {
for _, setCookie := range setCookies {
newCookie, err := http.ParseSetCookie(setCookie)
if err != nil {
continue
}
// keep processing to find last set cookie
if newCookie.Name == name {
cookie = newCookie
}
}
}
}
*/
}
if err != nil {
return false, err
}
if cookie == nil {
return false, err
return false, http.ErrNoCookie
}
token, err := jwt.ParseSigned(cookie.Value, []jose.SignatureAlgorithm{jose.EdDSA})