Browse Source

PSHB: work-around for SuperFeeder

Feeds using SuperFeeder for PubSubHubbub push had timeout problems
during substription.
SuperFeeder bot was returning 422 "We could not verify your callback
Error: ETIMEDOUT"
It seems to be due to the the fact that SuperFeeder bot uses keep-alive
but expects the server to close the connection.
https://github.com/FreshRSS/FreshRSS/issues/312#issuecomment-73716936
Alexandre Alapetite 9 years ago
parent
commit
462c1e208f
1 changed files with 2 additions and 0 deletions
  1. 2 0
      p/api/pshb.php

+ 2 - 0
p/api/pshb.php

@@ -65,11 +65,13 @@ if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'subscribe') {
 		$hubJson['error'] = true;	//Do not assume that PubSubHubbub works until the first successul push
 	}
 	file_put_contents('./!hub.json', json_encode($hubJson));
+	header('Connection: close');
 	exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : '');
 }
 
 if (!empty($_REQUEST['hub_mode']) && $_REQUEST['hub_mode'] === 'unsubscribe') {
 	if (empty($hubJson['lease_end']) || $hubJson['lease_end'] < time()) {
+		header('Connection: close');
 		exit(isset($_REQUEST['hub_challenge']) ? $_REQUEST['hub_challenge'] : '');
 	} else {
 		header('HTTP/1.1 422 Unprocessable Entity');