$message .= \sprintf(' for %s', $uriString);
}
// Create a connection exception if it was a specific error code.
$error = isset($connectionErrors[$easy->errno])
? new ConnectException($message, $easy->request, null, $ctx)
: new RequestException($message, $easy->request, $easy->response, null, $ctx);
return P\Create::rejectionFor($error);
}
// Retry when nothing is present or when curl failed to rewind.
if (empty($easy->options['_err_message']) && (!$easy->errno || $easy->errno == 65)) {
return self::retryFailedRewind($handler, $easy, $ctx);
}
return self::createRejection($easy, $ctx);
}
private static function createRejection(EasyHandle $easy, array $ctx): PromiseInterface
{
static $connectionErrors = [
if (isset($easy->options['on_stats'])) {
self::invokeStats($easy);
}
if (!$easy->response || $easy->errno) {
return self::finishError($handler, $easy, $factory);
}
// Return the response if it is present and there is no error.
$factory->release($easy);
$easy = $this->factory->create($request, $options);
\curl_exec($easy->handle);
$easy->errno = \curl_errno($easy->handle);
return CurlFactory::finish($this, $easy, $this->factory);
}
}
* @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.
*/
public static function wrapSync(callable $default, callable $sync): callable
{
return static function (RequestInterface $request, array $options) use ($default, $sync): PromiseInterface {
return empty($options[RequestOptions::SYNCHRONOUS]) ? $default($request, $options) : $sync($request, $options);
};
}
/**
* Sends streaming requests to a streaming compatible handler while sending
* @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.
*/
public static function wrapStreaming(callable $default, callable $streaming): callable
{
return static function (RequestInterface $request, array $options) use ($default, $streaming): PromiseInterface {
return empty($options['stream']) ? $default($request, $options) : $streaming($request, $options);
};
}
}
{
$fn = $this->nextHandler;
// Don't do anything if the request has no body.
if ($request->getBody()->getSize() === 0) {
return $fn($request, $options);
}
$modify = [];
// Add a default content-type if possible.
public static function cookies(): callable
{
return static function (callable $handler): callable {
return static function ($request, array $options) use ($handler) {
if (empty($options['cookies'])) {
return $handler($request, $options);
} elseif (!($options['cookies'] instanceof CookieJarInterface)) {
throw new \InvalidArgumentException('cookies must be an instance of GuzzleHttp\Cookie\CookieJarInterface');
}
$cookieJar = $options['cookies'];
$request = $cookieJar->withCookieHeader($request);
if (empty($options['allow_redirects']['max'])) {
return $fn($request, $options);
}
return $fn($request, $options)
->then(function (ResponseInterface $response) use ($request, $options) {
return $this->checkRedirect($request, $options, $response);
});
}
return static function (callable $handler) use ($bodySummarizer): callable {
return static function ($request, array $options) use ($handler, $bodySummarizer) {
if (empty($options['http_errors'])) {
return $handler($request, $options);
}
return $handler($request, $options)->then(
static function (ResponseInterface $response) use ($request, $bodySummarizer) {
$code = $response->getStatusCode();
if ($code < 400) {
return $response;
}
*/
public function __invoke(RequestInterface $request, array $options)
{
$handler = $this->resolve();
return $handler($request, $options);
}
/**
* Dumps a string representation of the stack.
*
$request = $this->applyOptions($request, $options);
/** @var HandlerStack $handler */
$handler = $options['handler'];
try {
return P\Create::promiseFor($handler($request, $options));
} catch (\Exception $e) {
return P\Create::rejectionFor($e);
}
}
}
$request = new Psr7\Request($method, $uri, $headers, $body, $version);
// Remove the option so that they are not doubly-applied.
unset($options['headers'], $options['body'], $options['version']);
return $this->transfer($request, $options);
}
/**
* Create and send an HTTP request.
*
* @throws GuzzleException
*/
public function request(string $method, $uri = '', array $options = []): ResponseInterface
{
$options[RequestOptions::SYNCHRONOUS] = true;
return $this->requestAsync($method, $uri, $options)->wait();
}
/**
* Get a client configuration option.
*
// 獲取原站模板
try{
$client = new Client(['timeout' => 5.0]);
$res = $client->request('GET', "http://".$proxy_domain, [
'headers' => [
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36',
]
]);
}catch (\GuzzleHttp\Exception\ClientException $e) {
return "error";
// return response(var_dump($get_path_domain),200);
# 緩存係統
if($this->path_setting['cache'] == 1){
$cache_view = Cache::get($request->fullUrl().check_spider(), function () use ($request, $proxy_domain){
$calc_view_data = self::calc_view_data($proxy_domain);
if($calc_view_data!="error"){
Cache::put($request->fullUrl().check_spider(), $calc_view_data);
return $calc_view_data;
}else{
* @param mixed $value
* @return mixed
*/
function value($value, ...$args)
{
return $value instanceof Closure ? $value(...$args) : $value;
}
}
// the default value for this cache value. This default could be a callback
// so we will execute the value function which will resolve it if needed.
if (is_null($value)) {
$this->event(new CacheMissed($key));
$value = value($default);
} else {
$this->event(new CacheHit($key, $value));
}
return $value;
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
return $this->store()->$method(...$parameters);
}
}
if (! $instance) {
throw new RuntimeException('A facade root has not been set.');
}
return $instance->$method(...$args);
}
}
}else{
$page404 = is_null($this->path_setting['page404'])?"nginx.blade.php":$this->path_setting['page404'];
$file = Str::of($page404)->rtrim('.blade.php');
return view('path.error.'.$file);
}
});
}else{
$cache_view = self::calc_view_data($proxy_domain."/".$request->path());
}
return response($cache_view);
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
});
}
/**
* Call a string reference to a class using Class@method syntax.
* @param mixed $value
* @return mixed
*/
public static function unwrapIfClosure($value)
{
return $value instanceof Closure ? $value() : $value;
}
/**
* Get the class name of the given parameter's type, if possible.
*
if ($container->hasMethodBinding($method)) {
return $container->callMethodBinding($method, $callback[0]);
}
return Util::unwrapIfClosure($default);
}
/**
* Normalize the given callback into a Class@method string.
*
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
});
}
/**
* Call a string reference to a class using Class@method syntax.
*
*
* @throws \InvalidArgumentException
*/
public function call($callback, array $parameters = [], $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
}
/**
* Get a closure to resolve the given type from the container.
*
*/
protected function callControllerCallable(callable $callable, array $parameters = [])
{
try {
return $this->prepareResponse(
$this->call($callable, $parameters)
);
} catch (HttpResponseException $e) {
return $e->getResponse();
}
}
return $this->callLumenControllerWithMiddleware(
$instance, $method, $routeInfo, $middleware
);
} else {
return $this->callControllerCallable(
[$instance, $method], $routeInfo[2]
);
}
}
/**
if (! method_exists($instance = $this->make($controller), $method)) {
throw new NotFoundHttpException;
}
if ($instance instanceof LumenController) {
return $this->callLumenController($instance, $method, $routeInfo);
} else {
return $this->callControllerCallable(
[$instance, $method], $routeInfo[2]
);
}
protected function callActionOnArrayBasedRoute($routeInfo)
{
$action = $routeInfo[1];
if (isset($action['uses'])) {
return $this->prepareResponse($this->callControllerAction($routeInfo));
}
foreach ($action as $value) {
if ($value instanceof Closure) {
$callable = $value->bindTo(new RoutingClosure);
// Pipe through route middleware...
if (isset($action['middleware'])) {
$middleware = $this->gatherMiddlewareClassNames($action['middleware']);
return $this->prepareResponse($this->sendThroughPipeline($middleware, function () {
return $this->callActionOnArrayBasedRoute($this['request']->route());
}));
}
return $this->prepareResponse(
$this->callActionOnArrayBasedRoute($routeInfo)
*/
protected function prepareDestination(BaseClosure $destination)
{
return function ($passable) use ($destination) {
try {
return $destination($passable);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
}
Log::info($request_ip."\t".$path_domains['proxy_domain'].$url."\t".$agent);
}
}
return $next($request);
}
}
// since the object we're given was already a fully instantiated object.
$parameters = [$passable, $stack];
}
$carry = method_exists($pipe, $this->method)
? $pipe->{$this->method}(...$parameters)
: $pipe(...$parameters);
return $this->handleCarry($carry);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
try {
$slice = parent::carry();
return ($slice($stack, $pipe))($passable);
} catch (Throwable $e) {
return $this->handleException($passable, $e);
}
};
};
{
$pipeline = array_reduce(
array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
);
return $pipeline($this->passable);
}
/**
* Run the pipeline and return the result.
*
{
if (count($middleware) > 0 && ! $this->shouldSkipMiddleware()) {
return (new Pipeline($this))
->send($this->make('request'))
->through($middleware)
->then($then);
}
return $then($this->make('request'));
}
if (isset($action['middleware'])) {
$middleware = $this->gatherMiddlewareClassNames($action['middleware']);
return $this->prepareResponse($this->sendThroughPipeline($middleware, function () {
return $this->callActionOnArrayBasedRoute($this['request']->route());
}));
}
return $this->prepareResponse(
$this->callActionOnArrayBasedRoute($routeInfo)
);
case Dispatcher::NOT_FOUND:
throw new NotFoundHttpException;
case Dispatcher::METHOD_NOT_ALLOWED:
throw new MethodNotAllowedHttpException($routeInfo[1]);
case Dispatcher::FOUND:
return $this->handleFoundRoute($routeInfo);
}
}
/**
* Handle a route found by the dispatcher.
if (isset($this->router->getRoutes()[$method.$pathInfo])) {
return $this->handleFoundRoute([true, $this->router->getRoutes()[$method.$pathInfo]['action'], []]);
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
}
->send($this->make('request'))
->through($middleware)
->then($then);
}
return $then($this->make('request'));
}
/**
* Prepare the response for sending.
*
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
}
}
* @param \Symfony\Component\HttpFoundation\Request|null $request
* @return void
*/
public function run($request = null)
{
$response = $this->dispatch($request);
if ($response instanceof SymfonyResponse) {
$response->send();
} else {
echo (string) $response;
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();
ConnectException
|
---|
GuzzleHttp\Exception\ConnectException: cURL error 28: Operation timed out after 5001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://www.whxywy.com/P3/ at /www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:210 at GuzzleHttp\Handler\CurlFactory::createRejection() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:158) at GuzzleHttp\Handler\CurlFactory::finishError() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:110) at GuzzleHttp\Handler\CurlFactory::finish() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php:47) at GuzzleHttp\Handler\CurlHandler->__invoke() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:28) at GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:48) at GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php:35) at GuzzleHttp\PrepareBodyMiddleware->__invoke() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Middleware.php:31) at GuzzleHttp\Middleware::GuzzleHttp\{closure}() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php:71) at GuzzleHttp\RedirectMiddleware->__invoke() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Middleware.php:63) at GuzzleHttp\Middleware::GuzzleHttp\{closure}() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/HandlerStack.php:75) at GuzzleHttp\HandlerStack->__invoke() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Client.php:331) at GuzzleHttp\Client->transfer() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Client.php:168) at GuzzleHttp\Client->requestAsync() (/www/wwwroot/tdk/vendor/guzzlehttp/guzzle/src/Client.php:187) at GuzzleHttp\Client->request() (/www/wwwroot/tdk/app/Http/Controllers/PathShowController.php:60) at App\Http\Controllers\PathShowController::calc_view_data() (/www/wwwroot/tdk/app/Http/Controllers/PathShowController.php:118) at App\Http\Controllers\PathShowController->App\Http\Controllers\{closure}() (/www/wwwroot/tdk/vendor/illuminate/collections/helpers.php:184) at value() (/www/wwwroot/tdk/vendor/illuminate/cache/Repository.php:105) at Illuminate\Cache\Repository->get() (/www/wwwroot/tdk/vendor/illuminate/cache/CacheManager.php:418) at Illuminate\Cache\CacheManager->__call() (/www/wwwroot/tdk/vendor/illuminate/support/Facades/Facade.php:261) at Illuminate\Support\Facades\Facade::__callStatic() (/www/wwwroot/tdk/app/Http/Controllers/PathShowController.php:128) at App\Http\Controllers\PathShowController->index() (/www/wwwroot/tdk/vendor/illuminate/container/BoundMethod.php:36) at Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() (/www/wwwroot/tdk/vendor/illuminate/container/Util.php:40) at Illuminate\Container\Util::unwrapIfClosure() (/www/wwwroot/tdk/vendor/illuminate/container/BoundMethod.php:93) at Illuminate\Container\BoundMethod::callBoundMethod() (/www/wwwroot/tdk/vendor/illuminate/container/BoundMethod.php:37) at Illuminate\Container\BoundMethod::call() (/www/wwwroot/tdk/vendor/illuminate/container/Container.php:653) at Illuminate\Container\Container->call() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:389) at Laravel\Lumen\Application->callControllerCallable() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:355) at Laravel\Lumen\Application->callLumenController() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:329) at Laravel\Lumen\Application->callControllerAction() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:282) at Laravel\Lumen\Application->callActionOnArrayBasedRoute() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:262) at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:48) at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}() (/www/wwwroot/tdk/app/Http/Middleware/LoggingMiddleware.php:43) at App\Http\Middleware\LoggingMiddleware->handle() (/www/wwwroot/tdk/vendor/illuminate/pipeline/Pipeline.php:167) at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:30) at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}() (/www/wwwroot/tdk/vendor/illuminate/pipeline/Pipeline.php:103) at Illuminate\Pipeline\Pipeline->then() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:426) at Laravel\Lumen\Application->sendThroughPipeline() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:263) at Laravel\Lumen\Application->handleFoundRoute() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:237) at Laravel\Lumen\Application->handleDispatcherResponse() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:173) at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:429) at Laravel\Lumen\Application->sendThroughPipeline() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:175) at Laravel\Lumen\Application->dispatch() (/www/wwwroot/tdk/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:112) at Laravel\Lumen\Application->run() (/www/wwwroot/tdk/public/index.php:28) |