[PATCH] Fix webpush response code handling
Export this patch
---
go.mod | 2 +-
server.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/go.mod b/go.mod
index c4a9bc2..4185f1c 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.15
require (
git.sr.ht/~emersion/go-scfg v0.0.0-20211215104734-c2c7a15d6c99
git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9
- github.com/SherClockHolmes/webpush-go v1.2.0 // indirect
+ github.com/SherClockHolmes/webpush-go v1.2.0
github.com/emersion/go-sasl v0.0.0-20211008083017-0b9dcfb154ac
github.com/klauspost/compress v1.14.4 // indirect
github.com/lib/pq v1.10.4
diff --git a/server.go b/server.go
index b78c7ea..1e6bb04 100644
--- a/server.go
+++ b/server.go
@@ -320,7 +320,7 @@ func (s *Server) sendWebPush(ctx context.Context, sub *webpush.Subscription, vap
// 404 means the subscription has expired as per RFC 8030 section 7.3
if resp.StatusCode == http.StatusNotFound {
return errWebPushSubscriptionExpired
- } else if resp.StatusCode%100 != 2 {
+ } else if resp.StatusCode/100 != 2 {
return fmt.Errorf("HTTP error: %v", resp.Status)
}
base-commit: 2b9e23c278a024a37b02949e5bb8ecb8cd1aab3c
prerequisite-patch-id: 8b3c75b8f6478011d6991294de16680c855bb3b4
--
2.17.1
Oops, thanks for the fix! Squashed into my webpush branch.