- common_log(LOG_DEBUG, __METHOD__ . ": checking sub'd to $feed $callback");
- if ($this->getSub($feed, $callback)) {
- // Already subscribed; return 204 per spec.
- header('HTTP/1.1 204 No Content');
- common_log(LOG_DEBUG, __METHOD__ . ': already subscribed');
- return;
+ $topic = $this->argUrl('hub.topic');
+ if (!$this->recognizedFeed($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));
+ }
+
+ $verify = $this->arg('hub.verify'); // @fixme may be multiple
+ if ($verify != 'sync' && $verify != 'async') {
+ // TRANS: Client exception.
+ throw new ClientException(sprintf(_m('Invalid hub.verify "%s". It must be sync or async.'),$verify));
+ }
+
+ $lease = $this->arg('hub.lease_seconds', null);
+ if ($mode == 'subscribe' && $lease != '' && !preg_match('/^\d+$/', $lease)) {
+ // TRANS: Client exception.
+ throw new ClientException(sprintf(_m('Invalid hub.lease "%s". It must be empty or positive integer.'),$lease));