summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-08-26 11:10:57 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-08-30 13:49:20 +0200
commiteba129631314840020c33ec3d7bc0891489f8c77 (patch)
treeac43df251ce369438d31998b4978ad17ed8a69a1
parentbfb488195bc3cbc0b86f539e03966cdb22831262 (diff)
API: Improve error when server does not give an expires header
Otherwise it gives a cryptic error during parsing
-rw-r--r--internal/api/api.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/api/api.go b/internal/api/api.go
index e9904bd..fe25862 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)