From 9c408b3acc9d818dc0199cb5d69040a287d68f3a Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Mon, 26 Aug 2024 11:10:57 +0200 Subject: [PATCH] API: Improve error when server does not give an expires header Otherwise it gives a cryptic error during parsing --- internal/api/api.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/api/api.go b/internal/api/api.go index e9904bdf..fe258624 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -301,6 +301,9 @@ func (a *API) Connect(ctx context.Context, prof profiles.Profile, protos []proto // Parse expiry expH := h.Get("expires") + if expH == "" { + return nil, errors.New("the server did not give an expires header") + } expT, err := http.ParseTime(expH) if err != nil { return nil, fmt.Errorf("failed parsing expiry time: %w", err)