Page MenuHomePhabricator

D12106.diff
No OneTemporary

D12106.diff

diff --git a/src/future/http/HTTPSFuture.php b/src/future/http/HTTPSFuture.php
--- a/src/future/http/HTTPSFuture.php
+++ b/src/future/http/HTTPSFuture.php
@@ -9,6 +9,7 @@
private static $results = array();
private static $pool = array();
private static $globalCABundle;
+ private static $globalUserCert;
private static $blindTrustDomains = array();
private $handle;
@@ -118,6 +119,38 @@
}
/**
+ * Set the global user certificate if one is not specified
+ * for the session, given a path.
+ *
+ * @param string The path to a valid user SSL certificate
+ * @return void
+ */
+ public static function setGlobalUserCertFromPath($path) {
+ self::$globalUserCert = $path;
+ }
+ /**
+ * Set the global user certificate if one is not specified
+ * for the session, given a string.
+ *
+ * @param string The certificate
+ * @return void
+ */
+ public static function setGlobalUserCertFromString($certificate) {
+ $temp = new TempFile();
+ Filesystem::writeFile($temp, $certificate);
+ self::$globalUserCert = $temp;
+ }
+
+ /**
+ * Get the global user SSL certificate
+ *
+ * @return string
+ */
+ public static function getGlobalUserCert() {
+ return self::$globalUserCert;
+ }
+
+ /**
* Set a list of domains to blindly trust. Certificates for these domains
* will not be validated.
*
@@ -346,6 +379,11 @@
curl_setopt($curl, CURLOPT_CAINFO, $this->getCABundle());
}
+
+ if (self::getGlobalUserCert()) {
+ curl_setopt($curl, CURLOPT_SSLCERT, self::getGlobalUserCert());
+ }
+
$domain = id(new PhutilURI($uri))->getDomain();
if (!empty(self::$blindTrustDomains[$domain])) {
// Disable peer verification for domains that we blindly trust.

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 2:22 AM (10 h, 48 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6784686
Default Alt Text
D12106.diff (1 KB)

Event Timeline