aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/www/include/share/facebook/HttpClients
diff options
context:
space:
mode:
authorM.Gergo2018-07-06 11:14:41 +0200
committerM.Gergo2018-07-06 11:14:41 +0200
commit43de9af71f7f4ca5731b94a06d688ae8412ba427 (patch)
tree54835de1dfcda504c02da261f0dc26885aed2e89 /mayor-orig/www/include/share/facebook/HttpClients
parent50310b0e4513ee3fcce67351ae61e8fff851130e (diff)
downloadmayor-43de9af71f7f4ca5731b94a06d688ae8412ba427.tar.gz
mayor-43de9af71f7f4ca5731b94a06d688ae8412ba427.zip
2018/Feb/28 -i állapot hozzáadva, mint a módosítások kiindulási állapota
Diffstat (limited to 'mayor-orig/www/include/share/facebook/HttpClients')
-rw-r--r--mayor-orig/www/include/share/facebook/HttpClients/FacebookCurl.php129
-rw-r--r--mayor-orig/www/include/share/facebook/HttpClients/FacebookCurlHttpClient.php163
-rw-r--r--mayor-orig/www/include/share/facebook/HttpClients/FacebookGuzzleHttpClient.php97
-rw-r--r--mayor-orig/www/include/share/facebook/HttpClients/FacebookHttpClientInterface.php47
-rw-r--r--mayor-orig/www/include/share/facebook/HttpClients/FacebookStream.php80
-rw-r--r--mayor-orig/www/include/share/facebook/HttpClients/FacebookStreamHttpClient.php94
-rw-r--r--mayor-orig/www/include/share/facebook/HttpClients/HttpClientsFactory.php99
-rw-r--r--mayor-orig/www/include/share/facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem23
8 files changed, 732 insertions, 0 deletions
diff --git a/mayor-orig/www/include/share/facebook/HttpClients/FacebookCurl.php b/mayor-orig/www/include/share/facebook/HttpClients/FacebookCurl.php
new file mode 100644
index 00000000..28e4ba59
--- /dev/null
+++ b/mayor-orig/www/include/share/facebook/HttpClients/FacebookCurl.php
@@ -0,0 +1,129 @@
+<?php
+/**
+ * Copyright 2017 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\HttpClients;
+
+/**
+ * Class FacebookCurl
+ *
+ * Abstraction for the procedural curl elements so that curl can be mocked and the implementation can be tested.
+ *
+ * @package Facebook
+ */
+class FacebookCurl
+{
+
+ /**
+ * @var resource Curl resource instance
+ */
+ protected $curl;
+
+ /**
+ * Make a new curl reference instance
+ */
+ public function init()
+ {
+ $this->curl = curl_init();
+ }
+
+ /**
+ * Set a curl option
+ *
+ * @param $key
+ * @param $value
+ */
+ public function setopt($key, $value)
+ {
+ curl_setopt($this->curl, $key, $value);
+ }
+
+ /**
+ * Set an array of options to a curl resource
+ *
+ * @param array $options
+ */
+ public function setoptArray(array $options)
+ {
+ curl_setopt_array($this->curl, $options);
+ }
+
+ /**
+ * Send a curl request
+ *
+ * @return mixed
+ */
+ public function exec()
+ {
+ return curl_exec($this->curl);
+ }
+
+ /**
+ * Return the curl error number
+ *
+ * @return int
+ */
+ public function errno()
+ {
+ return curl_errno($this->curl);
+ }
+
+ /**
+ * Return the curl error message
+ *
+ * @return string
+ */
+ public function error()
+ {
+ return curl_error($this->curl);
+ }
+
+ /**
+ * Get info from a curl reference
+ *
+ * @param $type
+ *
+ * @return mixed
+ */
+ public function getinfo($type)
+ {
+ return curl_getinfo($this->curl, $type);
+ }
+
+ /**
+ * Get the currently installed curl version
+ *
+ * @return array
+ */
+ public function version()
+ {
+ return curl_version();
+ }
+
+ /**
+ * Close the resource connection to curl
+ */
+ public function close()
+ {
+ curl_close($this->curl);
+ }
+}
diff --git a/mayor-orig/www/include/share/facebook/HttpClients/FacebookCurlHttpClient.php b/mayor-orig/www/include/share/facebook/HttpClients/FacebookCurlHttpClient.php
new file mode 100644
index 00000000..059e75a5
--- /dev/null
+++ b/mayor-orig/www/include/share/facebook/HttpClients/FacebookCurlHttpClient.php
@@ -0,0 +1,163 @@
+<?php
+/**
+ * Copyright 2017 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\HttpClients;
+
+use Facebook\Http\GraphRawResponse;
+use Facebook\Exceptions\FacebookSDKException;
+
+/**
+ * Class FacebookCurlHttpClient
+ *
+ * @package Facebook
+ */
+class FacebookCurlHttpClient implements FacebookHttpClientInterface
+{
+ /**
+ * @var string The client error message
+ */
+ protected $curlErrorMessage = '';
+
+ /**
+ * @var int The curl client error code
+ */
+ protected $curlErrorCode = 0;
+
+ /**
+ * @var string|boolean The raw response from the server
+ */
+ protected $rawResponse;
+
+ /**
+ * @var FacebookCurl Procedural curl as object
+ */
+ protected $facebookCurl;
+
+ /**
+ * @param FacebookCurl|null Procedural curl as object
+ */
+ public function __construct(FacebookCurl $facebookCurl = null)
+ {
+ $this->facebookCurl = $facebookCurl ?: new FacebookCurl();
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function send($url, $method, $body, array $headers, $timeOut)
+ {
+ $this->openConnection($url, $method, $body, $headers, $timeOut);
+ $this->sendRequest();
+
+ if ($curlErrorCode = $this->facebookCurl->errno()) {
+ throw new FacebookSDKException($this->facebookCurl->error(), $curlErrorCode);
+ }
+
+ // Separate the raw headers from the raw body
+ list($rawHeaders, $rawBody) = $this->extractResponseHeadersAndBody();
+
+ $this->closeConnection();
+
+ return new GraphRawResponse($rawHeaders, $rawBody);
+ }
+
+ /**
+ * Opens a new curl connection.
+ *
+ * @param string $url The endpoint to send the request to.
+ * @param string $method The request method.
+ * @param string $body The body of the request.
+ * @param array $headers The request headers.
+ * @param int $timeOut The timeout in seconds for the request.
+ */
+ public function openConnection($url, $method, $body, array $headers, $timeOut)
+ {
+ $options = [
+ CURLOPT_CUSTOMREQUEST => $method,
+ CURLOPT_HTTPHEADER => $this->compileRequestHeaders($headers),
+ CURLOPT_URL => $url,
+ CURLOPT_CONNECTTIMEOUT => 10,
+ CURLOPT_TIMEOUT => $timeOut,
+ CURLOPT_RETURNTRANSFER => true, // Follow 301 redirects
+ CURLOPT_HEADER => true, // Enable header processing
+ CURLOPT_SSL_VERIFYHOST => 2,
+ CURLOPT_SSL_VERIFYPEER => true,
+ CURLOPT_CAINFO => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
+ ];
+
+ if ($method !== "GET") {
+ $options[CURLOPT_POSTFIELDS] = $body;
+ }
+
+ $this->facebookCurl->init();
+ $this->facebookCurl->setoptArray($options);
+ }
+
+ /**
+ * Closes an existing curl connection
+ */
+ public function closeConnection()
+ {
+ $this->facebookCurl->close();
+ }
+
+ /**
+ * Send the request and get the raw response from curl
+ */
+ public function sendRequest()
+ {
+ $this->rawResponse = $this->facebookCurl->exec();
+ }
+
+ /**
+ * Compiles the request headers into a curl-friendly format.
+ *
+ * @param array $headers The request headers.
+ *
+ * @return array
+ */
+ public function compileRequestHeaders(array $headers)
+ {
+ $return = [];
+
+ foreach ($headers as $key => $value) {
+ $return[] = $key . ': ' . $value;
+ }
+
+ return $return;
+ }
+
+ /**
+ * Extracts the headers and the body into a two-part array
+ *
+ * @return array
+ */
+ public function extractResponseHeadersAndBody()
+ {
+ $parts = explode("\r\n\r\n", $this->rawResponse);
+ $rawBody = array_pop($parts);
+ $rawHeaders = implode("\r\n\r\n", $parts);
+
+ return [trim($rawHeaders), trim($rawBody)];
+ }
+}
diff --git a/mayor-orig/www/include/share/facebook/HttpClients/FacebookGuzzleHttpClient.php b/mayor-orig/www/include/share/facebook/HttpClients/FacebookGuzzleHttpClient.php
new file mode 100644
index 00000000..8feb7cb6
--- /dev/null
+++ b/mayor-orig/www/include/share/facebook/HttpClients/FacebookGuzzleHttpClient.php
@@ -0,0 +1,97 @@
+<?php
+/**
+ * Copyright 2017 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\HttpClients;
+
+use Facebook\Http\GraphRawResponse;
+use Facebook\Exceptions\FacebookSDKException;
+
+use GuzzleHttp\Client;
+use GuzzleHttp\Message\ResponseInterface;
+use GuzzleHttp\Ring\Exception\RingException;
+use GuzzleHttp\Exception\RequestException;
+
+class FacebookGuzzleHttpClient implements FacebookHttpClientInterface
+{
+ /**
+ * @var \GuzzleHttp\Client The Guzzle client.
+ */
+ protected $guzzleClient;
+
+ /**
+ * @param \GuzzleHttp\Client|null The Guzzle client.
+ */
+ public function __construct(Client $guzzleClient = null)
+ {
+ $this->guzzleClient = $guzzleClient ?: new Client();
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function send($url, $method, $body, array $headers, $timeOut)
+ {
+ $options = [
+ 'headers' => $headers,
+ 'body' => $body,
+ 'timeout' => $timeOut,
+ 'connect_timeout' => 10,
+ 'verify' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
+ ];
+ $request = $this->guzzleClient->createRequest($method, $url, $options);
+
+ try {
+ $rawResponse = $this->guzzleClient->send($request);
+ } catch (RequestException $e) {
+ $rawResponse = $e->getResponse();
+
+ if ($e->getPrevious() instanceof RingException || !$rawResponse instanceof ResponseInterface) {
+ throw new FacebookSDKException($e->getMessage(), $e->getCode());
+ }
+ }
+
+ $rawHeaders = $this->getHeadersAsString($rawResponse);
+ $rawBody = $rawResponse->getBody();
+ $httpStatusCode = $rawResponse->getStatusCode();
+
+ return new GraphRawResponse($rawHeaders, $rawBody, $httpStatusCode);
+ }
+
+ /**
+ * Returns the Guzzle array of headers as a string.
+ *
+ * @param ResponseInterface $response The Guzzle response.
+ *
+ * @return string
+ */
+ public function getHeadersAsString(ResponseInterface $response)
+ {
+ $headers = $response->getHeaders();
+ $rawHeaders = [];
+ foreach ($headers as $name => $values) {
+ $rawHeaders[] = $name . ": " . implode(", ", $values);
+ }
+
+ return implode("\r\n", $rawHeaders);
+ }
+}
diff --git a/mayor-orig/www/include/share/facebook/HttpClients/FacebookHttpClientInterface.php b/mayor-orig/www/include/share/facebook/HttpClients/FacebookHttpClientInterface.php
new file mode 100644
index 00000000..1fbf953d
--- /dev/null
+++ b/mayor-orig/www/include/share/facebook/HttpClients/FacebookHttpClientInterface.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Copyright 2017 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\HttpClients;
+
+/**
+ * Interface FacebookHttpClientInterface
+ *
+ * @package Facebook
+ */
+interface FacebookHttpClientInterface
+{
+ /**
+ * Sends a request to the server and returns the raw response.
+ *
+ * @param string $url The endpoint to send the request to.
+ * @param string $method The request method.
+ * @param string $body The body of the request.
+ * @param array $headers The request headers.
+ * @param int $timeOut The timeout in seconds for the request.
+ *
+ * @return \Facebook\Http\GraphRawResponse Raw response from the server.
+ *
+ * @throws \Facebook\Exceptions\FacebookSDKException
+ */
+ public function send($url, $method, $body, array $headers, $timeOut);
+}
diff --git a/mayor-orig/www/include/share/facebook/HttpClients/FacebookStream.php b/mayor-orig/www/include/share/facebook/HttpClients/FacebookStream.php
new file mode 100644
index 00000000..3f399884
--- /dev/null
+++ b/mayor-orig/www/include/share/facebook/HttpClients/FacebookStream.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Copyright 2017 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\HttpClients;
+
+/**
+ * Class FacebookStream
+ *
+ * Abstraction for the procedural stream elements so that the functions can be
+ * mocked and the implementation can be tested.
+ *
+ * @package Facebook
+ */
+class FacebookStream
+{
+ /**
+ * @var resource Context stream resource instance
+ */
+ protected $stream;
+
+ /**
+ * @var array Response headers from the stream wrapper
+ */
+ protected $responseHeaders = [];
+
+ /**
+ * Make a new context stream reference instance
+ *
+ * @param array $options
+ */
+ public function streamContextCreate(array $options)
+ {
+ $this->stream = stream_context_create($options);
+ }
+
+ /**
+ * The response headers from the stream wrapper
+ *
+ * @return array
+ */
+ public function getResponseHeaders()
+ {
+ return $this->responseHeaders;
+ }
+
+ /**
+ * Send a stream wrapped request
+ *
+ * @param string $url
+ *
+ * @return mixed
+ */
+ public function fileGetContents($url)
+ {
+ $rawResponse = file_get_contents($url, false, $this->stream);
+ $this->responseHeaders = $http_response_header ?: [];
+
+ return $rawResponse;
+ }
+}
diff --git a/mayor-orig/www/include/share/facebook/HttpClients/FacebookStreamHttpClient.php b/mayor-orig/www/include/share/facebook/HttpClients/FacebookStreamHttpClient.php
new file mode 100644
index 00000000..1cdfd539
--- /dev/null
+++ b/mayor-orig/www/include/share/facebook/HttpClients/FacebookStreamHttpClient.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Copyright 2017 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\HttpClients;
+
+use Facebook\Http\GraphRawResponse;
+use Facebook\Exceptions\FacebookSDKException;
+
+class FacebookStreamHttpClient implements FacebookHttpClientInterface
+{
+ /**
+ * @var FacebookStream Procedural stream wrapper as object.
+ */
+ protected $facebookStream;
+
+ /**
+ * @param FacebookStream|null Procedural stream wrapper as object.
+ */
+ public function __construct(FacebookStream $facebookStream = null)
+ {
+ $this->facebookStream = $facebookStream ?: new FacebookStream();
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function send($url, $method, $body, array $headers, $timeOut)
+ {
+ $options = [
+ 'http' => [
+ 'method' => $method,
+ 'header' => $this->compileHeader($headers),
+ 'content' => $body,
+ 'timeout' => $timeOut,
+ 'ignore_errors' => true
+ ],
+ 'ssl' => [
+ 'verify_peer' => true,
+ 'verify_peer_name' => true,
+ 'allow_self_signed' => true, // All root certificates are self-signed
+ 'cafile' => __DIR__ . '/certs/DigiCertHighAssuranceEVRootCA.pem',
+ ],
+ ];
+
+ $this->facebookStream->streamContextCreate($options);
+ $rawBody = $this->facebookStream->fileGetContents($url);
+ $rawHeaders = $this->facebookStream->getResponseHeaders();
+
+ if ($rawBody === false || empty($rawHeaders)) {
+ throw new FacebookSDKException('Stream returned an empty response', 660);
+ }
+
+ $rawHeaders = implode("\r\n", $rawHeaders);
+
+ return new GraphRawResponse($rawHeaders, $rawBody);
+ }
+
+ /**
+ * Formats the headers for use in the stream wrapper.
+ *
+ * @param array $headers The request headers.
+ *
+ * @return string
+ */
+ public function compileHeader(array $headers)
+ {
+ $header = [];
+ foreach ($headers as $k => $v) {
+ $header[] = $k . ': ' . $v;
+ }
+
+ return implode("\r\n", $header);
+ }
+}
diff --git a/mayor-orig/www/include/share/facebook/HttpClients/HttpClientsFactory.php b/mayor-orig/www/include/share/facebook/HttpClients/HttpClientsFactory.php
new file mode 100644
index 00000000..d9f2a8d3
--- /dev/null
+++ b/mayor-orig/www/include/share/facebook/HttpClients/HttpClientsFactory.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * Copyright 2017 Facebook, Inc.
+ *
+ * You are hereby granted a non-exclusive, worldwide, royalty-free license to
+ * use, copy, modify, and distribute this software in source code or binary
+ * form for use in connection with the web services and APIs provided by
+ * Facebook.
+ *
+ * As with any software that integrates with the Facebook platform, your use
+ * of this software is subject to the Facebook Developer Principles and
+ * Policies [http://developers.facebook.com/policy/]. This copyright notice
+ * shall be included in all copies or substantial portions of the software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+namespace Facebook\HttpClients;
+
+use GuzzleHttp\Client;
+use InvalidArgumentException;
+use Exception;
+
+class HttpClientsFactory
+{
+ private function __construct()
+ {
+ // a factory constructor should never be invoked
+ }
+
+ /**
+ * HTTP client generation.
+ *
+ * @param FacebookHttpClientInterface|Client|string|null $handler
+ *
+ * @throws Exception If the cURL extension or the Guzzle client aren't available (if required).
+ * @throws InvalidArgumentException If the http client handler isn't "curl", "stream", "guzzle", or an instance of Facebook\HttpClients\FacebookHttpClientInterface.
+ *
+ * @return FacebookHttpClientInterface
+ */
+ public static function createHttpClient($handler)
+ {
+ if (!$handler) {
+ return self::detectDefaultClient();
+ }
+
+ if ($handler instanceof FacebookHttpClientInterface) {
+ return $handler;
+ }
+
+ if ('stream' === $handler) {
+ return new FacebookStreamHttpClient();
+ }
+ if ('curl' === $handler) {
+ if (!extension_loaded('curl')) {
+ throw new Exception('The cURL extension must be loaded in order to use the "curl" handler.');
+ }
+
+ return new FacebookCurlHttpClient();
+ }
+
+ if ('guzzle' === $handler && !class_exists('GuzzleHttp\Client')) {
+ throw new Exception('The Guzzle HTTP client must be included in order to use the "guzzle" handler.');
+ }
+
+ if ($handler instanceof Client) {
+ return new FacebookGuzzleHttpClient($handler);
+ }
+ if ('guzzle' === $handler) {
+ return new FacebookGuzzleHttpClient();
+ }
+
+ throw new InvalidArgumentException('The http client handler must be set to "curl", "stream", "guzzle", be an instance of GuzzleHttp\Client or an instance of Facebook\HttpClients\FacebookHttpClientInterface');
+ }
+
+ /**
+ * Detect default HTTP client.
+ *
+ * @return FacebookHttpClientInterface
+ */
+ private static function detectDefaultClient()
+ {
+ if (extension_loaded('curl')) {
+ return new FacebookCurlHttpClient();
+ }
+
+ if (class_exists('GuzzleHttp\Client')) {
+ return new FacebookGuzzleHttpClient();
+ }
+
+ return new FacebookStreamHttpClient();
+ }
+}
diff --git a/mayor-orig/www/include/share/facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem b/mayor-orig/www/include/share/facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem
new file mode 100644
index 00000000..9e6810ab
--- /dev/null
+++ b/mayor-orig/www/include/share/facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem
@@ -0,0 +1,23 @@
+-----BEGIN CERTIFICATE-----
+MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
+ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
+MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
+LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
+RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
++9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
+PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
+xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
+Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
+hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
+EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
+MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
+FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
+nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
+eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
+hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
+Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
+vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
++OkuE6N36B9K
+-----END CERTIFICATE-----