From 452a1092044164eabe2294fd9630c34f76a530e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Wed, 8 May 2024 18:10:06 +0200 Subject: [PATCH] Read session UUID from cookie if header is missing. Bump to v0.2.14 --- pkg.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg.go b/pkg.go index 54e5b32..244173c 100644 --- a/pkg.go +++ b/pkg.go @@ -64,7 +64,7 @@ import ( "strings" ) -const VERSION = "v0.2.13" +const VERSION = "v0.2.14" type HttpHandler func(http.ResponseWriter, *http.Request) @@ -376,6 +376,11 @@ func sessionUUID(r *http.Request) (string, error) { // {{{ headers := r.Header["X-Session-Id"] if len(headers) > 0 { return headers[0], nil + } else { + cookie, err := r.Cookie("X-Session-ID") + if err == nil && cookie.Value != "" { + return cookie.Value, nil + } } return "", errors.New("Invalid session") } // }}}