From f4d6710a0f21612dc6a054c65154a82287330949 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 1 May 2017 11:04:27 +0200 Subject: [PATCH] Change mentions of PuSH to WebSub WebSub is probably finalised before we make a release anyway. Here is the official spec: https://www.w3.org/TR/websub/ Mostly just comments that have been changed. Some references to PuSH <0.4 are left because they actually refer to PuSH 0.3 and that's not WebSub... The only actual code change that might affect anything is FeedSub->isPuSH() but the only official plugin using that call was FeedPoller anyway... --- lib/activityhandlerplugin.php | 6 +- plugins/FeedPoller/FeedPollerPlugin.php | 6 +- plugins/FeedPoller/README | 2 +- .../FeedPoller/lib/feedpollqueuehandler.php | 2 +- plugins/FeedPoller/scripts/pollfeed.php | 2 +- plugins/OStatus/OStatusPlugin.php | 28 ++++----- plugins/OStatus/README | 11 ++-- plugins/OStatus/actions/pushcallback.php | 2 +- plugins/OStatus/actions/pushhub.php | 20 +++---- plugins/OStatus/classes/FeedSub.php | 59 ++++++++++--------- plugins/OStatus/classes/HubSub.php | 18 +++--- plugins/OStatus/classes/Ostatus_profile.php | 12 ++-- plugins/OStatus/lib/feeddiscovery.php | 2 +- plugins/OStatus/lib/hubconfqueuehandler.php | 4 +- plugins/OStatus/lib/huboutqueuehandler.php | 6 +- plugins/OStatus/lib/hubprepqueuehandler.php | 6 +- plugins/OStatus/lib/ostatusqueuehandler.php | 22 +++---- plugins/OStatus/lib/pushinqueuehandler.php | 4 +- plugins/OStatus/lib/pushrenewqueuehandler.php | 2 +- plugins/OStatus/scripts/resub-feed.php | 2 +- plugins/OStatus/scripts/testfeed.php | 2 +- plugins/OStatus/scripts/update-profile.php | 2 +- plugins/OStatus/tests/remote-tests.php | 2 +- plugins/SubMirror/README | 2 +- 24 files changed, 113 insertions(+), 111 deletions(-) diff --git a/lib/activityhandlerplugin.php b/lib/activityhandlerplugin.php index e1779bbe6a..afeebb53aa 100644 --- a/lib/activityhandlerplugin.php +++ b/lib/activityhandlerplugin.php @@ -147,7 +147,7 @@ abstract class ActivityHandlerPlugin extends Plugin * * This will handle just about all events where an activity * object gets saved, whether it is via AtomPub, OStatus - * (PuSH and Salmon transports), or ActivityStreams-based + * (WebSub and Salmon transports), or ActivityStreams-based * backup/restore of account data. * * You should be able to accept as input the output from an @@ -193,7 +193,7 @@ abstract class ActivityHandlerPlugin extends Plugin * * This will be how your specialized notice gets output in * Atom feeds and JSON-based ActivityStreams output, including - * account backup/restore and OStatus (PuSH and Salmon transports). + * account backup/restore and OStatus (WebSub and Salmon transports). * * You should be able to round-trip data from this format back * through $this->saveNoticeFromActivity(). Where applicable, try @@ -324,7 +324,7 @@ abstract class ActivityHandlerPlugin extends Plugin } /** - * Handle a posted object from PuSH + * Handle a posted object from WebSub * * @param Activity $activity activity to handle * @param Profile $actor Profile for the feed diff --git a/plugins/FeedPoller/FeedPollerPlugin.php b/plugins/FeedPoller/FeedPollerPlugin.php index e272c0b705..2326cd2f1b 100644 --- a/plugins/FeedPoller/FeedPollerPlugin.php +++ b/plugins/FeedPoller/FeedPollerPlugin.php @@ -1,6 +1,6 @@ isPuSH()) { + if (!$feedsub->isWebSub()) { FeedPoll::setupFeedSub($feedsub, $this->interval*60); return false; // We're polling this feed, so stop processing FeedSubscribe } @@ -39,7 +39,7 @@ class FeedPollerPlugin extends Plugin { public function onFeedUnsubscribe(FeedSub $feedsub) { - if (!$feedsub->isPuSH()) { + if (!$feedsub->isWebSub()) { // removes sub_state setting and such $feedsub->confirmUnsubscribe(); return false; diff --git a/plugins/FeedPoller/README b/plugins/FeedPoller/README index 11f28f2ba4..8fd9d55dc7 100644 --- a/plugins/FeedPoller/README +++ b/plugins/FeedPoller/README @@ -1,4 +1,4 @@ -The FeedPoller plugin allows users to subscribe to non-PuSH-enabled feeds +The FeedPoller plugin allows users to subscribe to non-WebSub-enabled feeds by regularly polling the source for new content. Installation diff --git a/plugins/FeedPoller/lib/feedpollqueuehandler.php b/plugins/FeedPoller/lib/feedpollqueuehandler.php index c0d9e48207..f0441a5700 100644 --- a/plugins/FeedPoller/lib/feedpollqueuehandler.php +++ b/plugins/FeedPoller/lib/feedpollqueuehandler.php @@ -22,7 +22,7 @@ class FeedPollQueueHandler extends QueueHandler return true; } if (!$feedsub->sub_state == 'nohub') { - // We're not supposed to poll this (either it's PuSH or it's unsubscribed) + // We're not supposed to poll this (either it's WebSub or it's unsubscribed) return true; } diff --git a/plugins/FeedPoller/scripts/pollfeed.php b/plugins/FeedPoller/scripts/pollfeed.php index 3aa8296416..58918495bf 100755 --- a/plugins/FeedPoller/scripts/pollfeed.php +++ b/plugins/FeedPoller/scripts/pollfeed.php @@ -47,7 +47,7 @@ if (!$feedsub instanceof FeedSub) { } if ($feedsub->sub_state != 'nohub') { - echo "Feed is a PuSH feed, so we will not poll it.\n"; + echo "Feed is a WebSub feed, so we will not poll it.\n"; exit(1); } diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 3fdfdaab9e..cea405fa9a 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -61,7 +61,7 @@ class OStatusPlugin extends Plugin $m->connect('main/ostatuspeopletag', array('action' => 'ostatuspeopletag')); - // PuSH actions + // WebSub actions $m->connect('main/push/hub', array('action' => 'pushhub')); $m->connect('main/push/callback/:feed', @@ -91,7 +91,7 @@ class OStatusPlugin extends Plugin // Prepare outgoing distributions after notice save. $qm->connect('ostatus', 'OStatusQueueHandler'); - // Outgoing from our internal PuSH hub + // Outgoing from our internal WebSub hub $qm->connect('hubconf', 'HubConfQueueHandler'); $qm->connect('hubprep', 'HubPrepQueueHandler'); @@ -100,7 +100,7 @@ class OStatusPlugin extends Plugin // Outgoing Salmon replies (when we don't need a return value) $qm->connect('salmon', 'SalmonQueueHandler'); - // Incoming from a foreign PuSH hub + // Incoming from a foreign WebSub hub $qm->connect('pushin', 'PushInQueueHandler'); // Re-subscribe feeds that need renewal @@ -126,7 +126,7 @@ class OStatusPlugin extends Plugin } /** - * Set up a PuSH hub link to our internal link for canonical timeline + * Set up a WebSub hub link to our internal link for canonical timeline * Atom feeds for users and groups. */ function onStartApiAtom($feed) @@ -153,7 +153,7 @@ class OStatusPlugin extends Plugin if (!empty($id)) { $hub = common_config('ostatus', 'hub'); if (empty($hub)) { - // Updates will be handled through our internal PuSH hub. + // Updates will be handled through our internal WebSub hub. $hub = common_local_url('pushhub'); } $feed->addLink($hub, array('rel' => 'hub')); @@ -547,7 +547,7 @@ class OStatusPlugin extends Plugin } /** - * Send incoming PuSH feeds for OStatus endpoints in for processing. + * Send incoming WebSub feeds for OStatus endpoints in for processing. * * @param FeedSub $feedsub * @param DOMDocument $feed @@ -583,10 +583,10 @@ class OStatusPlugin extends Plugin /** * When about to subscribe to a remote user, start a server-to-server - * PuSH subscription if needed. If we can't establish that, abort. + * WebSub subscription if needed. If we can't establish that, abort. * * @fixme If something else aborts later, we could end up with a stray - * PuSH subscription. This is relatively harmless, though. + * WebSub subscription. This is relatively harmless, though. * * @param Profile $profile subscriber * @param Profile $other subscribee @@ -660,7 +660,7 @@ class OStatusPlugin extends Plugin return true; } - // Drop the PuSH subscription if there are no other subscribers. + // Drop the WebSub subscription if there are no other subscribers. $oprofile->garbageCollect(); $act = new Activity(); @@ -761,7 +761,7 @@ class OStatusPlugin extends Plugin return true; } - // Drop the PuSH subscription if there are no other subscribers. + // Drop the WebSub subscription if there are no other subscribers. $oprofile->garbageCollect(); $member = $profile; @@ -858,7 +858,7 @@ class OStatusPlugin extends Plugin return true; } - // Drop the PuSH subscription if there are no other subscribers. + // Drop the WebSub subscription if there are no other subscribers. $oprofile->garbageCollect(); $sub = Profile::getKV($user->id); @@ -969,7 +969,7 @@ class OStatusPlugin extends Plugin $oprofile->notifyDeferred($act, $tagger); - // initiate a PuSH subscription for the person being tagged + // initiate a WebSub subscription for the person being tagged $oprofile->subscribe(); return true; } @@ -1020,7 +1020,7 @@ class OStatusPlugin extends Plugin $oprofile->notifyDeferred($act, $tagger); - // unsubscribe to PuSH feed if no more required + // unsubscribe to WebSub feed if no more required $oprofile->garbageCollect(); return true; @@ -1155,7 +1155,7 @@ class OStatusPlugin extends Plugin // Find foreign accounts I'm subscribed to that support Salmon pings. // - // @fixme we could run updates through the PuSH feed too, + // @fixme we could run updates through the WebSub feed too, // in which case we can skip Salmon pings to folks who // are also subscribed to me. $sql = "SELECT * FROM ostatus_profile " . diff --git a/plugins/OStatus/README b/plugins/OStatus/README index 4f839c863a..3b2fc7fd0d 100644 --- a/plugins/OStatus/README +++ b/plugins/OStatus/README @@ -3,26 +3,27 @@ The OStatus plugin concentrates on user-to-user cases for federating StatusNet and similar social networking / microblogging / blogging sites, but includes low-level feed subscription systems which are used by some other plugins. -Uses PubSubHubbub for push feed updates; currently non-PuSH feeds cannot be -subscribed unless an external PuSH hub proxy is used. +Uses WebSub (previously named PubSubHubbub or PuSH) for push feed updates; +currently non-WebSub feeds cannot be subscribed unless an external +WebSub hub proxy is used. Configuration options available: $config['ostatus']['hub'] (default internal hub) - Set to URL of an external PuSH hub to use it instead of our internal hub + Set to URL of an external WebSub hub to use it instead of our internal hub for sending outgoing updates in user and group feeds. $config['ostatus']['hub_retries'] (default 0) - Number of times to retry a PuSH send to consumers if using internal hub + Number of times to retry a WebSub send to consumers if using internal hub Settings controlling incoming feed subscription: $config['feedsub']['fallback_hub'] - To subscribe to feeds that don't have a hub, an external PuSH proxy hub + To subscribe to feeds that don't have a hub, an external WebSub proxy hub such as Superfeedr may be used. Any feed without a hub of its own will be subscribed through the specified hub URL instead. If the external hub has usage charges, be aware that there is no restriction placed to how diff --git a/plugins/OStatus/actions/pushcallback.php b/plugins/OStatus/actions/pushcallback.php index f5bb880df9..f2ce25118f 100644 --- a/plugins/OStatus/actions/pushcallback.php +++ b/plugins/OStatus/actions/pushcallback.php @@ -54,7 +54,7 @@ class PushCallbackAction extends Action $feedsub = FeedSub::getKV('id', $feedid); if (!$feedsub instanceof FeedSub) { // TRANS: Server exception. %s is a feed ID. - throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400); + throw new ServerException(sprintf(_m('Unknown WebSub subscription feed id %s'),$feedid), 400); } $hmac = ''; diff --git a/plugins/OStatus/actions/pushhub.php b/plugins/OStatus/actions/pushhub.php index 6dc22706c3..2b06e920a4 100644 --- a/plugins/OStatus/actions/pushhub.php +++ b/plugins/OStatus/actions/pushhub.php @@ -18,7 +18,7 @@ */ /** - * Integrated PuSH hub; lets us only ping them what need it. + * Integrated WebSub hub; lets us only ping them what need it. * @package Hub * @maintainer Brion Vibber */ @@ -71,7 +71,7 @@ class PushHubAction extends Action } /** - * Process a request for a new or modified PuSH feed subscription. + * Process a request for a new or modified WebSub feed subscription. * If asynchronous verification is requested, updates won't be saved immediately. * * HTTP return codes: @@ -83,24 +83,24 @@ class PushHubAction extends Action { $callback = $this->argUrl('hub.callback'); - common_debug('New PuSH hub request ('._ve($mode).') for callback '._ve($callback)); + common_debug('New WebSub hub request ('._ve($mode).') for callback '._ve($callback)); $topic = $this->argUrl('hub.topic'); if (!$this->recognizedFeed($topic)) { - common_debug('PuSH hub request had unrecognized feed topic=='._ve($topic)); + common_debug('WebSub hub request had unrecognized feed topic=='._ve($topic)); // TRANS: Client exception. %s is a topic. throw new ClientException(sprintf(_m('Unsupported hub.topic %s this hub only serves local user and group Atom feeds.'),$topic)); } $lease = $this->arg('hub.lease_seconds', null); if ($mode == 'subscribe' && $lease != '' && !preg_match('/^\d+$/', $lease)) { - common_debug('PuSH hub request had invalid lease_seconds=='._ve($lease)); + common_debug('WebSub hub request had invalid lease_seconds=='._ve($lease)); // TRANS: Client exception. %s is the invalid lease value. throw new ClientException(sprintf(_m('Invalid hub.lease "%s". It must be empty or positive integer.'),$lease)); } $secret = $this->arg('hub.secret', null); if ($secret != '' && strlen($secret) >= 200) { - common_debug('PuSH hub request had invalid secret=='._ve($secret)); + common_debug('WebSub hub request had invalid secret=='._ve($secret)); // TRANS: Client exception. %s is the invalid hub secret. throw new ClientException(sprintf(_m('Invalid hub.secret "%s". It must be under 200 bytes.'),$secret)); } @@ -108,7 +108,7 @@ class PushHubAction extends Action $sub = HubSub::getByHashkey($topic, $callback); if (!$sub instanceof HubSub) { // Creating a new one! - common_debug('PuSH creating new HubSub entry for topic=='._ve($topic).' to remote callback '._ve($callback)); + common_debug('WebSub creating new HubSub entry for topic=='._ve($topic).' to remote callback '._ve($callback)); $sub = new HubSub(); $sub->topic = $topic; $sub->callback = $callback; @@ -121,15 +121,15 @@ class PushHubAction extends Action $sub->setLease(intval($lease)); } } - common_debug('PuSH hub request is now:'._ve($sub)); + common_debug('WebSub hub request is now:'._ve($sub)); $verify = $this->arg('hub.verify'); // TODO: deprecated $token = $this->arg('hub.verify_token', null); // TODO: deprecated if ($verify == 'sync') { // pre-0.4 PuSH $sub->verify($mode, $token); header('HTTP/1.1 204 No Content'); - } else { // If $verify is not "sync", we might be using PuSH 0.4 - $sub->scheduleVerify($mode, $token); // If we were certain it's PuSH 0.4, token could be removed + } else { // If $verify is not "sync", we might be using WebSub or PuSH 0.4 + $sub->scheduleVerify($mode, $token); // If we were certain it's WebSub or PuSH 0.4, token could be removed header('HTTP/1.1 202 Accepted'); } } diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index 3972d74eaa..da86300975 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -25,7 +25,7 @@ if (!defined('GNUSOCIAL')) { exit(1); } */ /* -PuSH subscription flow: +WebSub (previously PubSubHubbub/PuSH) subscription flow: $profile->subscribe() sends a sub request to the hub... @@ -41,7 +41,7 @@ PuSH subscription flow: */ /** - * FeedSub handles low-level PubHubSubbub (PuSH) subscriptions. + * FeedSub handles low-level WebSub (PubSubHubbub/PuSH) subscriptions. * Higher-level behavior building OStatus stuff on top is handled * under Ostatus_profile. */ @@ -52,7 +52,7 @@ class FeedSub extends Managed_DataObject public $id; public $uri; // varchar(191) not 255 because utf8mb4 takes more space - // PuSH subscription data + // WebSub subscription data public $huburi; public $secret; public $sub_state; // subscribe, active, unsubscribe, inactive, nohub @@ -105,14 +105,15 @@ class FeedSub extends Managed_DataObject } /** - * Do we have a hub? Then we are a PuSH feed. - * https://en.wikipedia.org/wiki/PubSubHubbub + * Do we have a hub? Then we are a WebSub feed. + * WebSub standard: https://www.w3.org/TR/websub/ + * old: https://en.wikipedia.org/wiki/PubSubHubbub * * If huburi is empty, then doublecheck that we are not using * a fallback hub. If there is a fallback hub, it is only if the - * sub_state is "nohub" that we assume it's not a PuSH feed. + * sub_state is "nohub" that we assume it's not a WebSub feed. */ - public function isPuSH() + public function isWebSub() { if (empty($this->huburi) && (!common_config('feedsub', 'fallback_hub') @@ -151,7 +152,7 @@ class FeedSub extends Managed_DataObject /** * @param string $feeduri * @return FeedSub - * @throws FeedSubException if feed is invalid or lacks PuSH setup + * @throws FeedSubException if feed is invalid or lacks WebSub setup */ public static function ensureFeed($feeduri) { @@ -262,7 +263,7 @@ class FeedSub extends Managed_DataObject public function subscribe() { if ($this->sub_state && $this->sub_state != 'inactive') { - common_log(LOG_WARNING, sprintf('Attempting to (re)start PuSH subscription to %s in unexpected state %s', $this->getUri(), $this->sub_state)); + common_log(LOG_WARNING, sprintf('Attempting to (re)start WebSub subscription to %s in unexpected state %s', $this->getUri(), $this->sub_state)); } if (!Event::handle('FeedSubscribe', array($this))) { @@ -280,7 +281,7 @@ class FeedSub extends Managed_DataObject return; } else { // TRANS: Server exception. - throw new ServerException(_m('Attempting to start PuSH subscription for feed with no hub.')); + throw new ServerException(_m('Attempting to start WebSub subscription for feed with no hub.')); } } @@ -288,7 +289,7 @@ class FeedSub extends Managed_DataObject } /** - * Send a PuSH unsubscription request to the hub for this feed. + * Send a WebSub unsubscription request to the hub for this feed. * The hub will later send us a confirmation POST to /main/push/callback. * Warning: this will cancel the subscription even if someone else in * the system is using it. Most callers will want garbageCollect() instead, @@ -298,7 +299,7 @@ class FeedSub extends Managed_DataObject */ public function unsubscribe() { if ($this->sub_state != 'active') { - common_log(LOG_WARNING, sprintf('Attempting to (re)end PuSH subscription to %s in unexpected state %s', $this->getUri(), $this->sub_state)); + common_log(LOG_WARNING, sprintf('Attempting to (re)end WebSub subscription to %s in unexpected state %s', $this->getUri(), $this->sub_state)); } if (!Event::handle('FeedUnsubscribe', array($this))) { @@ -314,7 +315,7 @@ class FeedSub extends Managed_DataObject * A plugin should handle the FeedSub above and set the proper state * if there is no hub. (instead of 'nohub' it should be 'inactive' if * the instance has enabled feed polling for feeds that don't publish - * PuSH/WebSub hubs. FeedPoller is a plugin which enables polling. + * WebSub/PuSH hubs. FeedPoller is a plugin which enables polling. * * Secondly, if we don't have the setting "nohub" enabled (i.e.) * we're ready to poll ourselves, there is something odd with the @@ -323,7 +324,7 @@ class FeedSub extends Managed_DataObject if (!common_config('feedsub', 'nohub')) { // TRANS: Server exception. - throw new ServerException(_m('Attempting to end PuSH subscription for feed with no hub.')); + throw new ServerException(_m('Attempting to end WebSub subscription for feed with no hub.')); } return; @@ -343,11 +344,11 @@ class FeedSub extends Managed_DataObject public function garbageCollect() { if ($this->sub_state == '' || $this->sub_state == 'inactive') { - // No active PuSH subscription, we can just leave it be. + // No active WebSub subscription, we can just leave it be. return true; } - // PuSH subscription is either active or in an indeterminate state. + // WebSub subscription is either active or in an indeterminate state. // Check if we're out of subscribers, and if so send an unsubscribe. $count = 0; Event::handle('FeedSubSubscriberCount', array($this, &$count)); @@ -426,12 +427,12 @@ class FeedSub extends Managed_DataObject $client->setAuth($u, $p); } } else { - throw new FeedSubException('Server could not find a usable PuSH hub.'); + throw new FeedSubException('Server could not find a usable WebSub hub.'); } } $response = $client->post($hub, $headers, $post); $status = $response->getStatus(); - // PuSH specificed response status code + // WebSub specificed response status code if ($status == 202 || $status == 204) { common_log(LOG_INFO, __METHOD__ . ': sub req ok, awaiting verification callback'); return; @@ -440,7 +441,7 @@ class FeedSub extends Managed_DataObject $msg = sprintf(_m("Unexpected HTTP status: %d"), $status); } else if ($status == 422) { // Error code regarding something wrong in the data (it seems - // that we're talking to a PuSH hub at least, so let's check + // that we're talking to a WebSub hub at least, so let's check // our own data to be sure we're not mistaken somehow. $this->ensureHub(true); @@ -462,7 +463,7 @@ class FeedSub extends Managed_DataObject } /** - * Save PuSH subscription confirmation. + * Save WebSub subscription confirmation. * Sets approximate lease start and end times and finalizes state. * * @param int $lease_seconds provided hub.lease_seconds parameter, if given @@ -485,8 +486,8 @@ class FeedSub extends Managed_DataObject } /** - * Save PuSH unsubscription confirmation. - * Wipes active PuSH sub info and resets state. + * Save WebSub unsubscription confirmation. + * Wipes active WebSub sub info and resets state. */ public function confirmUnsubscribe() { @@ -503,7 +504,7 @@ class FeedSub extends Managed_DataObject } /** - * Accept updates from a PuSH feed. If validated, this object and the + * Accept updates from a WebSub feed. If validated, this object and the * feed (as a DOMDocument) will be passed to the StartFeedSubHandleFeed * and EndFeedSubHandleFeed events for processing. * @@ -521,7 +522,7 @@ class FeedSub extends Managed_DataObject common_log(LOG_INFO, sprintf(__METHOD__.': packet for %s with HMAC %s', _ve($this->getUri()), _ve($hmac))); if (!in_array($this->sub_state, array('active', 'nohub'))) { - common_log(LOG_ERR, sprintf(__METHOD__.': ignoring PuSH for inactive feed %s (in state %s)', _ve($this->getUri()), _ve($this->sub_state))); + common_log(LOG_ERR, sprintf(__METHOD__.': ignoring WebSub for inactive feed %s (in state %s)', _ve($this->getUri()), _ve($this->sub_state))); return; } @@ -604,7 +605,7 @@ class FeedSub extends Managed_DataObject if (preg_match('/^([0-9a-zA-Z\-\,]{3,16})=([0-9a-fA-F]+)$/', $hmac, $matches)) { $hash_algo = strtolower($matches[1]); $their_hmac = strtolower($matches[2]); - common_debug(sprintf(__METHOD__ . ': PuSH from feed %s uses HMAC algorithm %s with value: %s', _ve($this->getUri()), _ve($hash_algo), _ve($their_hmac))); + common_debug(sprintf(__METHOD__ . ': WebSub push from feed %s uses HMAC algorithm %s with value: %s', _ve($this->getUri()), _ve($hash_algo), _ve($their_hmac))); if (!in_array($hash_algo, hash_algos())) { // We can't handle this at all, PHP doesn't recognize the algorithm name ('md5', 'sha1', 'sha256' etc: https://secure.php.net/manual/en/function.hash-algos.php) @@ -618,19 +619,19 @@ class FeedSub extends Managed_DataObject $our_hmac = hash_hmac($hash_algo, $post, $this->secret); if ($their_hmac !== $our_hmac) { - common_log(LOG_ERR, sprintf(__METHOD__.': ignoring PuSH with bad HMAC hash: got %s, expected %s for feed %s from hub %s', _ve($their_hmac), _ve($our_hmac), _ve($this->getUri()), _ve($this->huburi))); - throw new FeedSubBadPushSignatureException('Incoming PuSH signature did not match expected HMAC hash.'); + common_log(LOG_ERR, sprintf(__METHOD__.': ignoring WebSub push with bad HMAC hash: got %s, expected %s for feed %s from hub %s', _ve($their_hmac), _ve($our_hmac), _ve($this->getUri()), _ve($this->huburi))); + throw new FeedSubBadPushSignatureException('Incoming WebSub push signature did not match expected HMAC hash.'); } return true; } else { - common_log(LOG_ERR, sprintf(__METHOD__.': ignoring PuSH with bogus HMAC==', _ve($hmac))); + common_log(LOG_ERR, sprintf(__METHOD__.': ignoring WebSub push with bogus HMAC==', _ve($hmac))); } } else { if (empty($hmac)) { return true; } else { - common_log(LOG_ERR, sprintf(__METHOD__.': ignoring PuSH with unexpected HMAC==%s', _ve($hmac))); + common_log(LOG_ERR, sprintf(__METHOD__.': ignoring WebSub push with unexpected HMAC==%s', _ve($hmac))); } } return false; diff --git a/plugins/OStatus/classes/HubSub.php b/plugins/OStatus/classes/HubSub.php index 7b911d1d66..d4c29c3ce1 100644 --- a/plugins/OStatus/classes/HubSub.php +++ b/plugins/OStatus/classes/HubSub.php @@ -20,7 +20,7 @@ if (!defined('GNUSOCIAL')) { exit(1); } /** - * PuSH feed subscription record + * WebSub (previously PuSH) feed subscription record * @package Hub * @author Brion Vibber */ @@ -78,7 +78,7 @@ class HubSub extends Managed_DataObject */ function setLease($length) { - common_debug('PuSH hub got requested lease_seconds=='._ve($length)); + common_debug('WebSub hub got requested lease_seconds=='._ve($length)); assert(is_int($length)); $min = 86400; // 3600*24 (one day) @@ -93,7 +93,7 @@ class HubSub extends Managed_DataObject $length = $max; } - common_debug('PuSH hub after sanitation: lease_seconds=='._ve($length)); + common_debug('WebSub hub after sanitation: lease_seconds=='._ve($length)); $this->sub_start = common_sql_now(); $this->sub_end = common_sql_date(time() + $length); } @@ -242,7 +242,7 @@ class HubSub extends Managed_DataObject $data = array('sub' => $sub, 'atom' => $atom, 'retries' => $retries); - common_log(LOG_INFO, "Queuing PuSH: {$this->getTopic()} to {$this->callback}"); + common_log(LOG_INFO, "Queuing WebSub: {$this->getTopic()} to {$this->callback}"); $qm = QueueManager::get(); $qm->enqueue($data, 'hubout'); } @@ -265,7 +265,7 @@ class HubSub extends Managed_DataObject $data = array('atom' => $atom, 'topic' => $this->getTopic(), 'pushCallbacks' => $pushCallbacks); - common_log(LOG_INFO, "Queuing PuSH batch: {$this->getTopic()} to ".count($pushCallbacks)." sites"); + common_log(LOG_INFO, "Queuing WebSub batch: {$this->getTopic()} to ".count($pushCallbacks)." sites"); $qm = QueueManager::get(); $qm->enqueue($data, 'hubprep'); return true; @@ -304,7 +304,7 @@ class HubSub extends Managed_DataObject } catch (Exception $e) { $response = null; - common_debug('PuSH callback to '._ve($this->callback).' for '._ve($this->getTopic()).' failed with exception: '._ve($e->getMessage())); + common_debug('WebSub callback to '._ve($this->callback).' for '._ve($this->getTopic()).' failed with exception: '._ve($e->getMessage())); } // XXX: DO NOT trust a Location header here, _especially_ from 'http' protocols, @@ -312,9 +312,9 @@ class HubSub extends Managed_DataObject // the most common change here is simply switching 'http' to 'https' and we will // solve 99% of all of these issues for now. There should be a proper mechanism // if we want to change the callback URLs, preferrably just manual resubscriptions - // from the remote side, combined with implemented PuSH subscription timeouts. + // from the remote side, combined with implemented WebSub subscription timeouts. - // We failed the PuSH, but it might be that the remote site has changed their configuration to HTTPS + // We failed the WebSub, but it might be that the remote site has changed their configuration to HTTPS if ('http' === parse_url($this->callback, PHP_URL_SCHEME)) { // Test if the feed callback for this node has migrated to HTTPS $httpscallback = preg_replace('/^http/', 'https', $this->callback, 1); @@ -324,7 +324,7 @@ class HubSub extends Managed_DataObject throw new AlreadyFulfilledException('The remote side has already established an HTTPS callback, deleting the legacy HTTP entry.'); } - common_debug('PuSH callback to '._ve($this->callback).' for '._ve($this->getTopic()).' trying HTTPS callback: '._ve($httpscallback)); + common_debug('WebSub callback to '._ve($this->callback).' for '._ve($this->getTopic()).' trying HTTPS callback: '._ve($httpscallback)); $response = $request->post($httpscallback, $headers); if ($response->isOk()) { $orig = clone($this); diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index b6df8d50a2..80e5974e21 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -239,7 +239,7 @@ class Ostatus_profile extends Managed_DataObject /** * Check if this remote profile has any active local subscriptions, and - * if not drop the PuSH subscription feed. + * if not drop the WebSub subscription feed. * * @return boolean true if subscription is removed, false if there are still subscribers to the feed * @throws Exception of various kinds on failure. @@ -250,7 +250,7 @@ class Ostatus_profile extends Managed_DataObject /** * Check if this remote profile has any active local subscriptions, and - * if not drop the PuSH subscription feed. + * if not drop the WebSub subscription feed. * * @return boolean true if subscription is removed, false if there are still subscribers to the feed * @throws Exception of various kinds on failure. @@ -267,7 +267,7 @@ class Ostatus_profile extends Managed_DataObject /** * Check if this remote profile has any active local subscriptions, so the - * PuSH subscription layer can decide if it can drop the feed. + * WebSub subscription layer can decide if it can drop the feed. * * This gets called via the FeedSubSubscriberCount event when running * FeedSub::garbageCollect(). @@ -429,7 +429,7 @@ class Ostatus_profile extends Managed_DataObject /** * Read and post notices for updates from the feed. * Currently assumes that all items in the feed are new, - * coming from a PuSH hub. + * coming from a WebSub hub. * * @param DOMDocument $doc * @param string $source identifier ("push") @@ -779,7 +779,7 @@ class Ostatus_profile extends Managed_DataObject $hints['salmon'] = $salmonuri; if (!$huburi && !common_config('feedsub', 'fallback_hub') && !common_config('feedsub', 'nohub')) { - // We can only deal with folks with a PuSH hub + // We can only deal with folks with a WebSub hub // unless we have something similar available locally. throw new FeedSubNoHubException(); } @@ -1177,7 +1177,7 @@ class Ostatus_profile extends Managed_DataObject } if (!$huburi && !common_config('feedsub', 'fallback_hub') && !common_config('feedsub', 'nohub')) { - // We can only deal with folks with a PuSH hub + // We can only deal with folks with a WebSub hub throw new FeedSubNoHubException(); } diff --git a/plugins/OStatus/lib/feeddiscovery.php b/plugins/OStatus/lib/feeddiscovery.php index 02c3ce0212..6baa07c0ea 100644 --- a/plugins/OStatus/lib/feeddiscovery.php +++ b/plugins/OStatus/lib/feeddiscovery.php @@ -94,7 +94,7 @@ class FeedDiscovery } /** - * Get the referenced PuSH hub link from an Atom feed. + * Get the referenced WebSub hub link from an Atom feed. * * @return mixed string or false */ diff --git a/plugins/OStatus/lib/hubconfqueuehandler.php b/plugins/OStatus/lib/hubconfqueuehandler.php index d26c45be04..6c06e677fe 100644 --- a/plugins/OStatus/lib/hubconfqueuehandler.php +++ b/plugins/OStatus/lib/hubconfqueuehandler.php @@ -22,7 +22,7 @@ if (!defined('STATUSNET')) { } /** - * Send a PuSH subscription verification from our internal hub. + * Send a WebSub subscription verification from our internal hub. * @package Hub * @author Brion Vibber */ @@ -46,7 +46,7 @@ class HubConfQueueHandler extends QueueHandler try { $sub->verify($mode, $token); } catch (Exception $e) { - common_log(LOG_ERR, "Failed PuSH $mode verify to $sub->callback for $sub->topic: " . + common_log(LOG_ERR, "Failed WebSub $mode verify to $sub->callback for $sub->topic: " . $e->getMessage()); // @fixme schedule retry? // @fixme just kill it? diff --git a/plugins/OStatus/lib/huboutqueuehandler.php b/plugins/OStatus/lib/huboutqueuehandler.php index 590f2e3b25..c35d90319e 100644 --- a/plugins/OStatus/lib/huboutqueuehandler.php +++ b/plugins/OStatus/lib/huboutqueuehandler.php @@ -22,7 +22,7 @@ if (!defined('STATUSNET')) { } /** - * Send a raw PuSH atom update from our internal hub. + * Send a raw WebSub push atom update from our internal hub. * @package Hub * @author Brion Vibber */ @@ -45,10 +45,10 @@ class HubOutQueueHandler extends QueueHandler try { $sub->push($atom); } catch (AlreadyFulfilledException $e) { - common_log(LOG_INFO, "Failed PuSH to $sub->callback for $sub->topic (".get_class($e)."): " . $e->getMessage()); + common_log(LOG_INFO, "Failed WebSub push to $sub->callback for $sub->topic (".get_class($e)."): " . $e->getMessage()); } catch (Exception $e) { $retries--; - $msg = "Failed PuSH to $sub->callback for $sub->topic (".get_class($e)."): " . $e->getMessage(); + $msg = "Failed WebSub push to $sub->callback for $sub->topic (".get_class($e)."): " . $e->getMessage(); if ($retries > 0) { common_log(LOG_INFO, "$msg; scheduling for $retries more tries"); diff --git a/plugins/OStatus/lib/hubprepqueuehandler.php b/plugins/OStatus/lib/hubprepqueuehandler.php index f6abfcf30d..f11ca42e62 100644 --- a/plugins/OStatus/lib/hubprepqueuehandler.php +++ b/plugins/OStatus/lib/hubprepqueuehandler.php @@ -22,7 +22,7 @@ if (!defined('STATUSNET')) { } /** - * When we have a large batch of PuSH consumers, we break the data set + * When we have a large batch of WebSub consumers, we break the data set * into smaller chunks. Enqueue final destinations... * * @package Hub @@ -67,14 +67,14 @@ class HubPrepQueueHandler extends QueueHandler $callback = array_shift($pushCallbacks); $sub = HubSub::getByHashkey($topic, $callback); if (!$sub) { - common_log(LOG_ERR, "Skipping PuSH delivery for deleted(?) consumer $callback on $topic"); + common_log(LOG_ERR, "Skipping WebSub delivery for deleted(?) consumer $callback on $topic"); continue; } $sub->distribute($atom); } } catch (Exception $e) { - common_log(LOG_ERR, "Exception during PuSH batch out: " . + common_log(LOG_ERR, "Exception during WebSub batch out: " . $e->getMessage() . " prepping $topic to $callback"); } diff --git a/plugins/OStatus/lib/ostatusqueuehandler.php b/plugins/OStatus/lib/ostatusqueuehandler.php index ac56e142f4..3ad6b3b2ab 100644 --- a/plugins/OStatus/lib/ostatusqueuehandler.php +++ b/plugins/OStatus/lib/ostatusqueuehandler.php @@ -22,7 +22,7 @@ if (!defined('STATUSNET')) { } /** - * Prepare PuSH and Salmon distributions for an outgoing message. + * Prepare WebSub and Salmon distributions for an outgoing message. * * @package OStatusPlugin * @author Brion Vibber @@ -30,7 +30,7 @@ if (!defined('STATUSNET')) { class OStatusQueueHandler extends QueueHandler { // If we have more than this many subscribing sites on a single feed, - // break up the PuSH distribution into smaller batches which will be + // break up the WebSub distribution into smaller batches which will be // rolled into the queue progressively. This reduces disruption to // other, shorter activities being enqueued while we work. const MAX_UNBATCHED = 50; @@ -132,7 +132,7 @@ class OStatusQueueHandler extends QueueHandler { if ($this->user) { common_debug("OSTATUS [{$this->notice->getID()}]: pushing feed for local user {$this->user->getID()}"); - // For local posts, ping the PuSH hub to update their feed. + // For local posts, ping the WebSub hub to update their feed. // http://identi.ca/api/statuses/user_timeline/1.atom $feed = common_local_url('ApiTimelineUser', array('id' => $this->user->id, @@ -144,7 +144,7 @@ class OStatusQueueHandler extends QueueHandler function pushGroup(User_group $group) { common_debug("OSTATUS [{$this->notice->getID()}]: pushing group '{$group->getNickname()}' profile_id={$group->profile_id}"); - // For a local group, ping the PuSH hub to update its feed. + // For a local group, ping the WebSub hub to update its feed. // Updates may come from either a local or a remote user. $feed = common_local_url('ApiTimelineGroup', array('id' => $group->getID(), @@ -155,7 +155,7 @@ class OStatusQueueHandler extends QueueHandler function pushPeopletag($ptag) { common_debug("OSTATUS [{$this->notice->getID()}]: pushing peopletag '{$ptag->id}'"); - // For a local people tag, ping the PuSH hub to update its feed. + // For a local people tag, ping the WebSub hub to update its feed. // Updates may come from either a local or a remote user. $feed = common_local_url('ApiTimelineList', array('id' => $ptag->id, @@ -221,7 +221,7 @@ class OStatusQueueHandler extends QueueHandler $atom = call_user_func_array($callback, $args); $this->pushFeedInternal($atom, $sub); } else { - common_log(LOG_INFO, "OSTATUS [{$this->notice->getID()}]: No PuSH subscribers for $feed"); + common_log(LOG_INFO, "OSTATUS [{$this->notice->getID()}]: No WebSub subscribers for $feed"); } } @@ -231,7 +231,7 @@ class OStatusQueueHandler extends QueueHandler * Not guaranteed safe in an environment with database replication. * * @param string $feed feed topic URI - * @param string $hub PuSH hub URI + * @param string $hub WebSub hub URI * @fixme can consolidate pings for user & group posts */ function pushFeedExternal($feed, $hub) @@ -242,15 +242,15 @@ class OStatusQueueHandler extends QueueHandler 'hub.url' => $feed); $response = $client->post($hub, array(), $data); if ($response->getStatus() == 204) { - common_log(LOG_INFO, "PuSH ping to hub $hub for $feed ok"); + common_log(LOG_INFO, "WebSub ping to hub $hub for $feed ok"); return true; } else { - common_log(LOG_ERR, "PuSH ping to hub $hub for $feed failed with HTTP " . + common_log(LOG_ERR, "WebSub ping to hub $hub for $feed failed with HTTP " . $response->getStatus() . ': ' . $response->getBody()); } } catch (Exception $e) { - common_log(LOG_ERR, "PuSH ping to hub $hub for $feed failed: " . $e->getMessage()); + common_log(LOG_ERR, "WebSub ping to hub $hub for $feed failed: " . $e->getMessage()); return false; } } @@ -265,7 +265,7 @@ class OStatusQueueHandler extends QueueHandler */ function pushFeedInternal($atom, $sub) { - common_log(LOG_INFO, "Preparing $sub->N PuSH distribution(s) for $sub->topic"); + common_log(LOG_INFO, "Preparing $sub->N WebSub distribution(s) for $sub->topic"); $n = 0; $batch = array(); while ($sub->fetch()) { diff --git a/plugins/OStatus/lib/pushinqueuehandler.php b/plugins/OStatus/lib/pushinqueuehandler.php index f996a7166c..c5615daad8 100644 --- a/plugins/OStatus/lib/pushinqueuehandler.php +++ b/plugins/OStatus/lib/pushinqueuehandler.php @@ -20,7 +20,7 @@ if (!defined('GNUSOCIAL')) { exit(1); } /** - * Process a feed distribution POST from a PuSH hub. + * Process a feed distribution POST from a WebSub (previously PuSH) hub. * @package FeedSub * @author Brion Vibber */ @@ -45,7 +45,7 @@ class PushInQueueHandler extends QueueHandler } catch(NoResultException $e) { common_log(LOG_INFO, "Discarding POST to unknown feed subscription id {$feedsub_id}"); } catch(Exception $e) { - common_log(LOG_ERR, "Exception "._ve(get_class($e))." during PuSH input processing for {$feedsub->getUri()}: " . $e->getMessage()); + common_log(LOG_ERR, "Exception "._ve(get_class($e))." during WebSub push input processing for {$feedsub->getUri()}: " . $e->getMessage()); } return true; } diff --git a/plugins/OStatus/lib/pushrenewqueuehandler.php b/plugins/OStatus/lib/pushrenewqueuehandler.php index d79cbe503f..31df9b5f63 100644 --- a/plugins/OStatus/lib/pushrenewqueuehandler.php +++ b/plugins/OStatus/lib/pushrenewqueuehandler.php @@ -39,7 +39,7 @@ class PushRenewQueueHandler extends QueueHandler common_log(LOG_INFO, "Renewing feed subscription\n\tExp.: {$feedsub->sub_end}\n\tFeed: {$feedsub->uri}\n\tHub: {$feedsub->huburi}"); $feedsub->renew(); } catch(Exception $e) { - common_log(LOG_ERR, "Exception during PuSH renew processing for $feedsub->uri: " . $e->getMessage()); + common_log(LOG_ERR, "Exception during WebSub renew processing for $feedsub->uri: " . $e->getMessage()); } } else { common_log(LOG_ERR, "Discarding renew for unknown feed subscription id $feedsub_id"); diff --git a/plugins/OStatus/scripts/resub-feed.php b/plugins/OStatus/scripts/resub-feed.php index 37b09883db..48db9f4e6a 100755 --- a/plugins/OStatus/scripts/resub-feed.php +++ b/plugins/OStatus/scripts/resub-feed.php @@ -25,7 +25,7 @@ $shortoptions = 'u'; $helptext = <<