Ejemplo n.º 1
0
 public static function getHKPResponse($uri)
 {
     $config = Keyserver::getConfig();
     try {
         return Factory::forward(Keyserver::getRequest())->to('http://' . ($addr = (($primary = $config->hkp_primary_keyserver_addr && (strpos($uri, '/pks/lookup?op=stats') === 0 || strpos($uri, '/pks/hashquery') === 0)) ? $config->hkp_primary_keyserver_addr : $config->hkp_load_balanced_addr) . ':' . (!$primary && $config->hkp_load_balanced_port ? $config->hkp_load_balanced_port : $config->hkp_public_port)) . $uri);
     } catch (\Exception $e) {
         return new Response(Log::catchError($e, 'Double-check if the keyserver is up and running at the expected address:port (' . $addr . ').'));
     }
 }
Ejemplo n.º 2
0
 private function getPage()
 {
     // Create the proxy factory.
     $proxy = Factory::create();
     // Add a response filter that removes the encoding headers.
     $proxy->addResponseFilter(new RemoveEncodingFilter());
     // Create a Symfony request based on the current browser request.
     $request = Request::createFromGlobals();
     // Forward the request and get the response.
     $response = $proxy->forward($request)->to($this->page);
     // Output response to the browser.
     $response->send();
 }
Ejemplo n.º 3
0
use Proxy\Factory;
use Proxy\Response\Filter\RemoveEncodingFilter;
use Symfony\Component\HttpFoundation\Request;
require 'vendor/autoload.php';
require 'src/Encrypt.php';
// $uri = $_SERVER['REQUEST_SCHEME']. "://" .$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
// $uri = $_SERVER['REQUEST_URI'];
// $c = new App_Sandbox_Cipher('Magesh');
// $encrypted = $c->encrypt($uri);
// die($c->decrypt("5b132560a9cd7841d82681fd8b9dfa7992cf3f9755c8778b"));
// $path = "http://phpserver.2fh.co/".$encrypted;
// $path = "https://college-great.appspot.com/main.php?url=".$uri;
// die("$uri<br>$path");
$path = "http://www.google.com";
// Create the proxy factory.
$proxy = Factory::create();
// Add a response filter that removes the encoding headers.
// $proxy->addResponseFilter(new RemoveEncodingFilter());
// Create a Symfony request based on the current browser request.
$request = Request::createFromGlobals();
// Forward the request and get the response.
$response = $proxy->forward($request)->to($path);
// die($response);
$content = $response->getContent();
try {
    $gzip = @gzdecode($content);
} catch (Exception $e) {
    die("I could not create a car");
}
if ($gzip) {
    $response->setContent($gzip);
Ejemplo n.º 4
0
 public static function validateKey($key, $mail)
 {
     echo 'Checking ' . $mail . '..<br />';
     return strpos(Factory::forward(Request::create('/pks/lookup?search=' . $key . '&op=vindex'))->to('http://' . Keyserver::getConfig()->hkp_load_balanced_addr . ':' . (Keyserver::getConfig()->hkp_load_balanced_port ?: Keyserver::getConfig()->hkp_public_port) . '/pks/lookup?search=' . $key . '&op=vindex')->getContent(), $mail) !== FALSE;
 }
Ejemplo n.º 5
0
 public function __construct()
 {
     $this->cache = new Client();
     $this->proxy = Factory::create();
     $this->proxy->addResponseFilter(new RemoveEncodingFilter());
 }
Ejemplo n.º 6
0
<?php

// ini_set('display_errors', 'On');
// error_reporting(E_ALL);
require 'vendor/autoload.php';
use Proxy\Factory;
use Proxy\Response\Filter\RemoveEncodingFilter;
use Symfony\Component\HttpFoundation\Request;
// Create a Symfony request based on the current browser request.
$request = Request::createFromGlobals();
// Forward the request and get the response.
$response = Factory::forward($request)->to($_REQUEST['url']);
// Output response to the browser.
// echo $response->getContent();
$response->send();