Disable SSL verification in order to prevent download update failures.

@param array  $args Http args.
@param string $url Url to check.

@return array $array
429754
function http_request_args( $args, $url ) {
		// If it is an https request and we are performing a package download, disable ssl verification.
		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
			$args['sslverify'] = false;
		}

		return $args;
	}
1316962
protected function normalizeArgs(array $args)
    {
        $args += [
            'resultsPerPage' => null,
            'allowedDownloadFormats' => null,
        ];
        $normalized = [];
        $error = $this->app->make('helper/validation/error');
        /* @var \Concrete\Core\Error\ErrorList\ErrorList $error */
        $valn = $this->app->make('helper/validation/numbers');
        /* @var \Concrete\Core\Utility\Service\Validation\Numbers $valn */
        if ($valn->integer($args['resultsPerPage'], 1)) {
            $normalized['resultsPerPage'] = (int) $args['resultsPerPage'];
        } else {
            $error->add(t('Please specify the number of search results per page.'));
        }
        $allowedDownloadFormats = [];
        if (is_array($args['allowedDownloadFormats'])) {
            $tcProvider = $this->app->make(TranslationsConverterProvider::class);
            foreach (array_unique($args['allowedDownloadFormats']) as $adf) {
                if ($tcProvider->isRegistered($adf) === false) {
                    $error->add(t('Invalid format identifier received'));
                } else {
                    $allowedDownloadFormats[] = $adf;
                }
            }
        }
        $normalized['allowedDownloadFormats'] = implode(',', $allowedDownloadFormats);
        $normalized['allowedDownloadFor'] = (isset($args['allowedDownloadFor']) && is_string($args['allowedDownloadFor'])) ? $args['allowedDownloadFor'] : '';
        if (!array_key_exists($normalized['allowedDownloadFor'], $this->getDownloadAccessLevels())) {
            $error->add(t('Please specify who can download the translations'));
        }
        if (!$error->has()) {
            if ($normalized['allowedDownloadFor'] !== static::ALLOWDOWNLOADFOR_NOBODY && $normalized['allowedDownloadFormats'] === '') {
                $error->add(t('If you specify that some user can download the translations, you should specify the allowed download formats'));
            }
        }

        return $error->has() ? $error : $normalized;
    }
719977
public static function url($url, $params = null)
    {
        if (!is_array($params) || count($params) < 1) {
            return $url;
        }

        $pos = strpos($url, "?");

        # If there is no question mark in the url then set this as the first parameter
        if ($pos === false) {
            $url .= "?";

        # If the question mark is the last character then no appending is required
        } elseif ($pos != (mb_strlen($url) - 1)) {

            # If the last character is not an ampersand then append one
            if (mb_substr($url, -1) != "&") {
                $url .= "&";
            }
        }

        $url .= http_build_query($params);

        return $url;
    }
542540
function build($url,$args=[]) {
		$args+=$this->hive['PARAMS'];
		if (is_array($url))
			foreach ($url as &$var) {
				$var=$this->build($var,$args);
				unset($var);
			}
		else {
			$i=0;
			$url=preg_replace_callback('/@(\w+)|(\*)/',
				function($match) use(&$i,$args) {
					if (isset($match[1]) &&
						array_key_exists($match[1],$args))
						return $args[$match[1]];
					if (isset($match[2]) &&
						array_key_exists($match[2],$args)) {
						if (!is_array($args[$match[2]]))
							return $args[$match[2]];
						$i++;
						return $args[$match[2]][$i-1];
					}
					return $match[0];
				},$url);
		}
		return $url;
	}
799975
private function checkWebPage($url, $ssl = false)
    {
        $success = $this->requestSuccessful($url, $ssl);

        return [$success, $success ? '' : $this->getErrorMessage()];
    }
473575
public function readFromUrl($url, array $options = []): Certificate
    {
        $urlHost = parse_url($url, PHP_URL_HOST);

        if ($urlHost === null) {
            $urlHost = $url;
        }
    
        $urlPort = parse_url($url, PHP_URL_PORT);
    
        if ($urlPort === null) {
            $urlPort = self::DEFAULT_PORT;
        }
    
        $options = $this->prepareReadFromUrlOptions($options);

        $streamContext = stream_context_create(array(
            'ssl' => array(
                'capture_peer_cert' => TRUE,
                'verify_peer'       => FALSE,
                'verify_peer_name'  => FALSE
            )
        ));

        $stream = @stream_socket_client(
            sprintf('ssl://%s:%d', $urlHost, $urlPort),
            $errorNumber,
            $errorString,
            $options[self::OPT_CONNECTION_TIMEOUT],
            STREAM_CLIENT_CONNECT,
            $streamContext
        );

        if ($stream) {
            $streamParams = stream_context_get_params($stream);

            $certResource = $streamParams['options']['ssl']['peer_certificate'];

            return new Certificate($this->certResourceToString($certResource));
        }
        
        throw new Exception(
            sprintf('Unable to connect to %s:%d', $urlHost, $urlPort),
            Exception::CONNECTION_PROBLEM
        );
    }
509599
private function getParams(array $args)
    {
        if (count($args) == 0) {
            return [];
        }

        $params = array_slice($args, -1)[0];

        return is_array($params) ? $params : [];
    }
799944
protected function file($args) {
		$target   = $args['target'];
		$download = !empty($args['download']);
		$h403     = 'HTTP/1.x 403 Access Denied';
		$h404     = 'HTTP/1.x 404 Not Found';

		if (($volume = $this->volume($target)) == false) { 
			return array('error' => 'File not found', 'header' => $h404, 'raw' => true);
		}
		
		if (($file = $volume->file($target)) == false) {
			return array('error' => 'File not found', 'header' => $h404, 'raw' => true);
		}
		
		if (!$file['read']) {
			return array('error' => 'Access denied', 'header' => $h403, 'raw' => true);
		}
		
		if (($fp = $volume->open($target)) == false) {
			return array('error' => 'File not found', 'header' => $h404, 'raw' => true);
		}

		if ($download) {
			$disp = 'attachment';
			$mime = 'application/force-download';
		} else {
			$disp  = preg_match('/^(image|text)/i', $file['mime']) || $file['mime'] == 'application/x-shockwave-flash' 
					? 'inline' 
					: 'attachment';
			$mime = $file['mime'];
		}
		
		$filenameEncoded = rawurlencode($file['name']);
		if (strpos($filenameEncoded, '%') === false) { // ASCII only
			$filename = 'filename="'.$file['name'].'"';
		} else {
			$ua = $_SERVER["HTTP_USER_AGENT"];
			if (preg_match('/MSIE [4-8]/', $ua)) { // IE < 9 do not support RFC 6266 (RFC 2231/RFC 5987)
				$filename = 'filename="'.$filenameEncoded.'"';
			} elseif (strpos($ua, 'Chrome') === false && strpos($ua, 'Safari') !== false) { // Safari
				$filename = 'filename="'.str_replace('"', '', $file['name']).'"';
			} else { // RFC 6266 (RFC 2231/RFC 5987)
				$filename = 'filename*=UTF-8\'\''.$filenameEncoded;
			}
		}
		
		$result = array(
			'volume'  => $volume,
			'pointer' => $fp,
			'info'    => $file,
			'header'  => array(
				'Content-Type: '.$mime, 
				'Content-Disposition: '.$disp.'; '.$filename,
				'Content-Location: '.$file['name'],
				'Content-Transfer-Encoding: binary',
				'Content-Length: '.$file['size'],
				'Connection: close'
			)
		);
		return $result;
	}
941864
public function filter_pre_http_request( $response, $args, $url ) {
		// check if whitelisted
		if ( ! isset( $this->whitelist[ $url ] ) ) {
			return $response;
		}
		// check if downloading
		if ( 'GET' !== $args['method'] || empty( $args['filename'] ) ) {
			return $response;
		}
		// check cache and export to designated location
		$filename = $this->cache->has( $this->whitelist[ $url ]['key'], $this->whitelist[ $url ]['ttl'] );
		if ( $filename ) {
			WP_CLI::log( sprintf( 'Using cached file \'%s\'...', $filename ) );
			if ( copy( $filename, $args['filename'] ) ) {
				// simulate successful download response
				return array(
					'response' => array(
						'code'    => 200,
						'message' => 'OK',
					),
					'filename' => $args['filename'],
				);
			}

			WP_CLI::error( sprintf( 'Error copying cached file %s to %s', $filename, $url ) );
		}
		return $response;
	}
1144623
public function query($url = '', $argsOrParams = array(), $params = array())
    {
        if (strpos($url, '%s') === false) {
            $argsOrParams = $argsOrParams + $this->request->getQueries();
        } else {
            $params += $this->request->getQueries();
        }
        return $this->__invoke($url, $argsOrParams, $params);
    }
897482
public function preProcessAuthenticate(array $args)
    {

        $args      = $args[0];
        $signature = isset($args->signature) ? $args->signature : null;
        $extra     = isset($args->extra) ? $args->extra : null;

        if (!$signature) {
            return ['ERROR'];
        }

        return $this->processAuthenticate($signature, $extra);
    }
1073144
private function buildUrl($url, $parameters)
    {
        $prams_former = '?';

        foreach ($parameters as $key => $value) {
            $prams_former = $prams_former.$key.'='.$value.'&';
        }

        return $url.substr($prams_former, 0, -1);
    }
61617
protected function encodeContent(array $args) {
        $data = [];
        foreach ($args as $key => $item) {
            $data[] = sprintf('"%s":"%s"', $key, $item);
        }
        $arg = '{'.implode(',', $data).'}';
        if (!empty($this->encryptKey)
            && $this->encryptType == self::AES) {
            return (new Aes($this->encryptKey))->encrypt($arg);
        }
        return $arg;
    }
279126
private static function checkArgs(array $args) {
        if ($_FILES) {
            foreach ($_FILES as $key => $f) {
                if (is_array($f['name'])) {
                    foreach ($f['tmp_name'] as $tmp) {
                        $args[ $key ][] = self::getfileSha1('@"' . $tmp . '"');
                    }
                } else {
                    $args[ $key ] = self::getfileSha1('@"' . $f['tmp_name'] . '"');
                }
            }
        }

        return $args;
    }
1098652
public function purgeUrls(array $urls)
    {
        if (strpos($this->domain, 'http') === false) {
            throw new \InvalidArgumentException("'domain' is not configured for fastly driver");
        }

        if (strpos($this->domain, 'http') !== 0) {
            throw new \InvalidArgumentException("'domain' must include the protocol, e.g. http://www.foo.com");
        }

        foreach ($urls as $url) {
            if (!$this->sendRequest('PURGE', $this->domain . $url)) {
                return false;
            }
        }

        return true;
    }
200458
public function validateUrl($url)
    {
        if (empty($url)) {
            throw new \InvalidArgumentException('The field cannot be empty.');
        }

        if (!filter_var($url, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException('The field requires a valid URL.');
        }

        return $url;
    }
527045
protected function valid($args = array())
    {
         return array_key_exists('repo_token', $args) 
            && array_key_exists('target_url', $args)
            && array_key_exists('coverage_dir', $args)
            && array_key_exists('namespace', $args);
    }