ヤミRoot VoidGate
User / IP
:
216.73.216.143
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
logercm
/
dev.loger.cm
/
fixtures
/
assert
/
Viewing: web-link.tar
EventListener/AddLinkHeaderListener.php 0000644 00000003043 15120140625 0014165 0 ustar 00 <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\WebLink\EventListener; use Psr\Link\LinkProviderInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\WebLink\HttpHeaderSerializer; // Help opcache.preload discover always-needed symbols class_exists(HttpHeaderSerializer::class); /** * Adds the Link HTTP header to the response. * * @author Kévin Dunglas <dunglas@gmail.com> * * @final */ class AddLinkHeaderListener implements EventSubscriberInterface { private $serializer; public function __construct() { $this->serializer = new HttpHeaderSerializer(); } public function onKernelResponse(ResponseEvent $event) { if (!$event->isMainRequest()) { return; } $linkProvider = $event->getRequest()->attributes->get('_links'); if (!$linkProvider instanceof LinkProviderInterface || !$links = $linkProvider->getLinks()) { return; } $event->getResponse()->headers->set('Link', $this->serializer->serialize($links), false); } /** * {@inheritdoc} */ public static function getSubscribedEvents(): array { return [KernelEvents::RESPONSE => 'onKernelResponse']; } } CHANGELOG.md 0000644 00000000144 15120140625 0006350 0 ustar 00 CHANGELOG ========= 4.4.0 ----- * implement PSR-13 directly 3.3.0 ----- * added the component GenericLinkProvider.php 0000644 00000003167 15120140625 0011165 0 ustar 00 <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\WebLink; use Psr\Link\EvolvableLinkProviderInterface; use Psr\Link\LinkInterface; class GenericLinkProvider implements EvolvableLinkProviderInterface { /** * @var LinkInterface[] */ private $links = []; /** * @param LinkInterface[] $links */ public function __construct(array $links = []) { $that = $this; foreach ($links as $link) { $that = $that->withLink($link); } $this->links = $that->links; } /** * {@inheritdoc} */ public function getLinks(): array { return array_values($this->links); } /** * {@inheritdoc} */ public function getLinksByRel($rel): array { $links = []; foreach ($this->links as $link) { if (\in_array($rel, $link->getRels())) { $links[] = $link; } } return $links; } /** * {@inheritdoc} * * @return static */ public function withLink(LinkInterface $link) { $that = clone $this; $that->links[spl_object_id($link)] = $link; return $that; } /** * {@inheritdoc} * * @return static */ public function withoutLink(LinkInterface $link) { $that = clone $this; unset($that->links[spl_object_id($link)]); return $that; } } HttpHeaderSerializer.php 0000644 00000003331 15120140625 0011333 0 ustar 00 <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\WebLink; use Psr\Link\LinkInterface; /** * Serializes a list of Link instances to an HTTP Link header. * * @see https://tools.ietf.org/html/rfc5988 * * @author Kévin Dunglas <dunglas@gmail.com> */ final class HttpHeaderSerializer { /** * Builds the value of the "Link" HTTP header. * * @param LinkInterface[]|\Traversable $links */ public function serialize(iterable $links): ?string { $elements = []; foreach ($links as $link) { if ($link->isTemplated()) { continue; } $attributesParts = ['', sprintf('rel="%s"', implode(' ', $link->getRels()))]; foreach ($link->getAttributes() as $key => $value) { if (\is_array($value)) { foreach ($value as $v) { $attributesParts[] = sprintf('%s="%s"', $key, preg_replace('/(?<!\\\\)"/', '\"', $v)); } continue; } if (!\is_bool($value)) { $attributesParts[] = sprintf('%s="%s"', $key, preg_replace('/(?<!\\\\)"/', '\"', $value)); continue; } if (true === $value) { $attributesParts[] = $key; } } $elements[] = sprintf('<%s>%s', $link->getHref(), implode('; ', $attributesParts)); } return $elements ? implode(',', $elements) : null; } } LICENSE 0000644 00000002054 15120140625 0005546 0 ustar 00 Copyright (c) 2004-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission 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. Link.php 0000644 00000006507 15120140625 0006156 0 ustar 00 <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\WebLink; use Psr\Link\EvolvableLinkInterface; class Link implements EvolvableLinkInterface { // Relations defined in https://www.w3.org/TR/html5/links.html#links and applicable on link elements public const REL_ALTERNATE = 'alternate'; public const REL_AUTHOR = 'author'; public const REL_HELP = 'help'; public const REL_ICON = 'icon'; public const REL_LICENSE = 'license'; public const REL_SEARCH = 'search'; public const REL_STYLESHEET = 'stylesheet'; public const REL_NEXT = 'next'; public const REL_PREV = 'prev'; // Relation defined in https://www.w3.org/TR/preload/ public const REL_PRELOAD = 'preload'; // Relations defined in https://www.w3.org/TR/resource-hints/ public const REL_DNS_PREFETCH = 'dns-prefetch'; public const REL_PRECONNECT = 'preconnect'; public const REL_PREFETCH = 'prefetch'; public const REL_PRERENDER = 'prerender'; // Extra relations public const REL_MERCURE = 'mercure'; private $href = ''; /** * @var string[] */ private $rel = []; /** * @var array<string, string|bool|string[]> */ private $attributes = []; public function __construct(string $rel = null, string $href = '') { if (null !== $rel) { $this->rel[$rel] = $rel; } $this->href = $href; } /** * {@inheritdoc} */ public function getHref(): string { return $this->href; } /** * {@inheritdoc} */ public function isTemplated(): bool { return $this->hrefIsTemplated($this->href); } /** * {@inheritdoc} */ public function getRels(): array { return array_values($this->rel); } /** * {@inheritdoc} */ public function getAttributes(): array { return $this->attributes; } /** * {@inheritdoc} * * @return static */ public function withHref($href) { $that = clone $this; $that->href = $href; return $that; } /** * {@inheritdoc} * * @return static */ public function withRel($rel) { $that = clone $this; $that->rel[$rel] = $rel; return $that; } /** * {@inheritdoc} * * @return static */ public function withoutRel($rel) { $that = clone $this; unset($that->rel[$rel]); return $that; } /** * {@inheritdoc} * * @param string|\Stringable|int|float|bool|string[] $value * * @return static */ public function withAttribute($attribute, $value) { $that = clone $this; $that->attributes[$attribute] = $value; return $that; } /** * {@inheritdoc} * * @return static */ public function withoutAttribute($attribute) { $that = clone $this; unset($that->attributes[$attribute]); return $that; } private function hrefIsTemplated(string $href): bool { return str_contains($href, '{') || str_contains($href, '}'); } } README.md 0000644 00000002542 15120140625 0006022 0 ustar 00 WebLink Component ================= The WebLink component manages links between resources. It is particularly useful to advise clients to preload and prefetch documents through HTTP and HTTP/2 pushes. This component implements the [HTML5's Links](https://www.w3.org/TR/html5/links.html), [Preload](https://www.w3.org/TR/preload/) and [Resource Hints](https://www.w3.org/TR/resource-hints/) W3C's specifications. It can also be used with extensions defined in the [HTML5 link type extensions wiki](http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions). Getting Started --------------- ``` $ composer require symfony/web-link ``` ```php use Symfony\Component\WebLink\GenericLinkProvider; use Symfony\Component\WebLink\HttpHeaderSerializer; use Symfony\Component\WebLink\Link; $linkProvider = (new GenericLinkProvider()) ->withLink(new Link('preload', '/bootstrap.min.css')); header('Link: '.(new HttpHeaderSerializer())->serialize($linkProvider->getLinks())); echo 'Hello'; ``` Resources --------- * [Documentation](https://symfony.com/doc/current/web_link.html) * [Contributing](https://symfony.com/doc/current/contributing/index.html) * [Report issues](https://github.com/symfony/symfony/issues) and [send Pull Requests](https://github.com/symfony/symfony/pulls) in the [main Symfony repository](https://github.com/symfony/symfony) composer.json 0000644 00000002117 15120140625 0007263 0 ustar 00 { "name": "symfony/web-link", "type": "library", "description": "Manages links between resources", "keywords": ["link", "psr13", "http", "http2", "preload", "prefetch", "prerender", "dns-prefetch", "push", "performance"], "homepage": "https://symfony.com", "license": "MIT", "authors": [ { "name": "Kévin Dunglas", "email": "dunglas@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], "provide": { "psr/link-implementation": "1.0" }, "require": { "php": ">=7.2.5", "psr/link": "^1.0", "symfony/polyfill-php80": "^1.16" }, "suggest": { "symfony/http-kernel": "" }, "require-dev": { "symfony/http-kernel": "^5.3|^6.0" }, "conflict": { "symfony/http-kernel": "<5.3" }, "autoload": { "psr-4": { "Symfony\\Component\\WebLink\\": "" }, "exclude-from-classmap": [ "/Tests/" ] }, "minimum-stability": "dev" }
Coded With 💗 by
0x6ick