summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrion Vibber <brion@status.net>2010-08-09 13:11:41 -0700
committerBrion Vibber <brion@status.net>2010-08-09 13:11:41 -0700
commit855f1f6623e64701796f443fc20fde164b1a1846 (patch)
treee433f4ba85c560c7895d7e9c6bb586bbbbddac5e /lib
parentedb62db613478d50def223ec1d60ef5863fa3a4b (diff)
parent09dee24cbeadfb1fef797d38265e2ece09266bb0 (diff)
Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 1.0.x
Diffstat (limited to 'lib')
-rw-r--r--lib/default.php3
-rw-r--r--lib/httpclient.php13
-rw-r--r--lib/mailbox.php1
-rw-r--r--lib/noticelist.php3
4 files changed, 18 insertions, 2 deletions
diff --git a/lib/default.php b/lib/default.php
index e0081f316..76e4e44cf 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -321,6 +321,7 @@ $default =
'maxlength' => 25,
'maxnoticelength' => -1),
'http' => // HTTP client settings when contacting other sites
- array('ssl_cafile' => false // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt')
+ array('ssl_cafile' => false, // To enable SSL cert validation, point to a CA bundle (eg '/usr/lib/ssl/certs/ca-certificates.crt')
+ 'curl' => false, // Use CURL backend for HTTP fetches if available. (If not, PHP's socket streams will be used.)
),
);
diff --git a/lib/httpclient.php b/lib/httpclient.php
index b69f718e5..514a5afeb 100644
--- a/lib/httpclient.php
+++ b/lib/httpclient.php
@@ -145,6 +145,10 @@ class HTTPClient extends HTTP_Request2
$this->config['ssl_verify_peer'] = false;
}
+ if (common_config('http', 'curl') && extension_loaded('curl')) {
+ $this->config['adapter'] = 'HTTP_Request2_Adapter_Curl';
+ }
+
parent::__construct($url, $method, $config);
$this->setHeader('User-Agent', $this->userAgent());
}
@@ -204,6 +208,15 @@ class HTTPClient extends HTTP_Request2
protected function doRequest($url, $method, $headers)
{
$this->setUrl($url);
+
+ // Workaround for HTTP_Request2 not setting up SNI in socket contexts;
+ // This fixes cert validation for SSL virtual hosts using SNI.
+ // Requires PHP 5.3.2 or later and OpenSSL with SNI support.
+ if ($this->url->getScheme() == 'https' && defined('OPENSSL_TLSEXT_SERVER_NAME')) {
+ $this->config['ssl_SNI_enabled'] = true;
+ $this->config['ssl_SNI_server_name'] = $this->url->getHost();
+ }
+
$this->setMethod($method);
if ($headers) {
foreach ($headers as $header) {
diff --git a/lib/mailbox.php b/lib/mailbox.php
index 90a58b4c4..2b00f5ffd 100644
--- a/lib/mailbox.php
+++ b/lib/mailbox.php
@@ -224,6 +224,7 @@ class MailboxAction extends CurrentUserDesignAction
if ($message->source) {
$this->elementStart('span', 'source');
+ // FIXME: bad i18n. Device should be a parameter (from %s).
$this->text(_('from'));
$this->element('span', 'device', $this->showSource($message->source));
$this->elementEnd('span');
diff --git a/lib/noticelist.php b/lib/noticelist.php
index 17adf3a49..dbc5bfb51 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -499,9 +499,10 @@ class NoticeListItem extends Widget
$ns = $this->notice->getSource();
if ($ns) {
- $source_name = _($ns->code);
+ $source_name = (empty($ns->name)) ? _($ns->code) : _($ns->name);
$this->out->text(' ');
$this->out->elementStart('span', 'source');
+ // FIXME: probably i18n issue. If "from" is followed by text, that should be a parameter to "from" (from %s).
$this->out->text(_('from'));
$this->out->text(' ');