* @link http://status.net/
*/
-if (!defined('GNUSOCIAL')) {
- exit(1);
-}
-
-require_once 'HTTP/Request2.php';
-require_once 'HTTP/Request2/Response.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
/**
* Useful structure for HTTP responses
do {
try {
$response = parent::send();
- } catch (HTTP_Request2_Exception $e) {
+ } catch (Exception $e) {
$this->log(LOG_ERR, $e->getMessage());
throw $e;
}
continue;
} catch (HTTP_Request2_Exception $e) {
common_log(LOG_ERR, __CLASS__ . ": Invalid $code redirect from $url to $target");
+ } catch (NoHttpResponseException $e) {
+ common_log(LOG_ERR, __CLASS__ . ": {$e->getMessage()}");
}
} else {
$reason = $response->getReasonPhrase();
$client = new HTTPClient();
$client->setBody('xml=' . Magicsig::base64_url_encode($envxml));
$response = $client->post($endpoint_uri, $headers);
- } catch (HTTP_Request2_Exception $e) {
+ } catch (Exception $e) {
common_log(LOG_ERR, "Diaspora-flavoured Salmon post to $endpoint_uri failed: " . $e->getMessage());
return false;
}
$request->post($this->ping,
null,
array('p' => $url));
- } catch (HTTP_Request2_Exception $e) {
+ } catch (Exception $e) {
common_log(LOG_WARNING,
"GeoURL.org ping failed for '$url' ($this->ping)");
}
common_log(LOG_WARNING,
"Webmention request failed for '$url' ($endpoint)");
}
- } catch (HTTP_Request2_Exception $e) {
- common_log(LOG_WARNING,
- "Webmention request failed for '$url' ($endpoint)");
+ } catch (Exception $e) {
+ common_log(LOG_WARNING, "Webmention request failed for '{$url}' ({$endpoint}): {$e->getMessage()}");
}
}
"Pingback success for '$url' ($endpoint): ".
"'$response'");
}
- } catch (HTTP_Request2_Exception $e) {
- common_log(LOG_WARNING,
- "Pingback request failed for '$url' ($endpoint)");
+ } catch (Exception $e) {
+ common_log(LOG_WARNING, "Pingback request failed for '{$url}' ({$endpoint}): {$e->getMessage()}");
}
}
$client = new HTTPClient();
$client->setBody($envxml);
$response = $client->post($endpoint_uri, $headers);
- } catch (HTTP_Request2_Exception $e) {
+ } catch (Exception $e) {
common_log(LOG_ERR, "Salmon post to $endpoint_uri failed: " . $e->getMessage());
return false;
}
try {
$client = new HTTPClient();
$response = $client->get($url);
- } catch (HTTP_Request2_Exception $e) {
+ } catch (Exception $e) {
common_log(LOG_ERR, __METHOD__ . " Failure for $url - " . $e->getMessage());
throw new FeedSubBadURLException($e->getMessage());
}
try {
$client = new HTTPClient();
$response = $client->get($url);
- } catch (HTTP_Request2_Exception $e) {
+ } catch (Exception $e) {
common_log(LOG_INFO,
'RSSCloud plugin - failure testing notify handler ' .
$endpoint . ' - ' . $e->getMessage());
try {
$client = new HTTPClient();
$response = $client->post($endpoint, $headers, $postdata);
- } catch (HTTP_Request2_Exception $e) {
+ } catch (Exception $e) {
common_log(LOG_INFO, 'RSSCloud plugin - failure notifying ' .
$endpoint . ' that feed ' . $feed .
' has changed: ' . $e->getMessage());
try {
$client = new HTTPClient();
$response = $client->get($url);
- } catch (HTTP_Request2_Exception $e) {
+ } catch (Exception $e) {
print "ERROR: HTTP response " . $e->getMessage() . "\n";
return false;
}