From 918b10de6982fb4d3b9975a2ac65f588bc36a6e8 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Wed, 10 May 2017 07:59:03 -0700 Subject: [PATCH] if a subscriber returns HTTP 410, deactivate the subscription --- lib/PushTask.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/PushTask.php b/lib/PushTask.php index 5d9b886..f61c7ee 100644 --- a/lib/PushTask.php +++ b/lib/PushTask.php @@ -181,6 +181,14 @@ class PushTask { if(request\response_is($response['status'], 2)) { $subscription->last_ping_success = 1; $subscription->last_ping_error_delay = 0; + } elseif($response['status'] == 410) { + // If the subscriber returns HTTP 410, then take that as an indication that they no longer want more notifications and deactivate this subscription + // https://github.com/w3c/websub/issues/106 + // https://github.com/w3c/websub/issues/103 + echo "Deactivating subscription based on HTTP 410 response returned\n"; + $subscription->last_ping_success = 0; + $subscription->active = 0; + } else { $subscription->last_ping_success = 0; // If the ping failed, queue another ping for a later time with exponential backoff