Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7197eaebf2
commit
9c0f8de791
15771 changed files with 1564103 additions and 5 deletions
256
vendor/guzzlehttp/psr7/src/Message.php
vendored
Normal file
256
vendor/guzzlehttp/psr7/src/Message.php
vendored
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace GuzzleHttp\Psr7;
|
||||
|
||||
use Psr\Http\Message\MessageInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
|
||||
final class Message
|
||||
{
|
||||
private const DEFAULT_BODY_SUMMARY_TRUNCATE_AT = 120;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string representation of an HTTP message.
|
||||
*
|
||||
* @param MessageInterface $message Message to convert to a string.
|
||||
*/
|
||||
public static function toString(MessageInterface $message): string
|
||||
{
|
||||
if ($message instanceof RequestInterface) {
|
||||
$msg = trim($message->getMethod().' '
|
||||
.$message->getRequestTarget(), " \n\r\t\0\x0B")
|
||||
.' HTTP/'.$message->getProtocolVersion();
|
||||
if (!$message->hasHeader('host')) {
|
||||
$msg .= "\r\nHost: ".self::hostHeaderFromUri($message->getUri());
|
||||
}
|
||||
} elseif ($message instanceof ResponseInterface) {
|
||||
$msg = 'HTTP/'.$message->getProtocolVersion().' '
|
||||
.$message->getStatusCode().' '
|
||||
.$message->getReasonPhrase();
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Unknown message type');
|
||||
}
|
||||
|
||||
foreach ($message->getHeaders() as $name => $values) {
|
||||
if (is_string($name) && Utils::asciiToLower($name) === 'set-cookie') {
|
||||
foreach ($values as $value) {
|
||||
$msg .= "\r\n{$name}: ".$value;
|
||||
}
|
||||
} else {
|
||||
$msg .= "\r\n{$name}: ".implode(', ', $values);
|
||||
}
|
||||
}
|
||||
|
||||
return "{$msg}\r\n\r\n".$message->getBody();
|
||||
}
|
||||
|
||||
private static function hostHeaderFromUri(UriInterface $uri): string
|
||||
{
|
||||
$host = $uri->getHost();
|
||||
|
||||
if ($host === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
Uri::assertValidHost($host);
|
||||
|
||||
if (($port = $uri->getPort()) !== null) {
|
||||
$host .= ':'.$port;
|
||||
}
|
||||
|
||||
return $host;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a short summary of the message body.
|
||||
*
|
||||
* Will return `null` if the response is not printable.
|
||||
*
|
||||
* Reads seekable bodies from the beginning and restores the original cursor
|
||||
* position before returning. Pass `null` for `$truncateAt` to use the
|
||||
* default summary length.
|
||||
*
|
||||
* @param MessageInterface $message The message to get the body summary
|
||||
* @param int|null $truncateAt Maximum allowed size of the summary
|
||||
*/
|
||||
public static function bodySummary(MessageInterface $message, ?int $truncateAt = null): ?string
|
||||
{
|
||||
$truncateAt ??= self::DEFAULT_BODY_SUMMARY_TRUNCATE_AT;
|
||||
|
||||
$body = $message->getBody();
|
||||
|
||||
if (!$body->isSeekable() || !$body->isReadable()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$size = $body->getSize();
|
||||
|
||||
if ($size === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$position = $body->tell();
|
||||
|
||||
try {
|
||||
$body->rewind();
|
||||
$summary = $body->read($truncateAt);
|
||||
|
||||
if ($size > $truncateAt) {
|
||||
if (preg_match('//u', $summary) !== 1) {
|
||||
$summary = self::trimTrailingIncompleteUtf8Character($summary, $body->read(3));
|
||||
}
|
||||
|
||||
$summary .= ' (truncated...)';
|
||||
}
|
||||
} finally {
|
||||
$body->seek($position);
|
||||
}
|
||||
|
||||
// Matches any printable character, including unicode characters:
|
||||
// letters, marks, numbers, punctuation, spacing, and separators.
|
||||
if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/u', $summary) !== 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims a partial UTF-8 character from the end of a truncated string.
|
||||
*/
|
||||
private static function trimTrailingIncompleteUtf8Character(string $summary, string $lookahead): string
|
||||
{
|
||||
$length = strlen($summary);
|
||||
|
||||
if ($length === 0) {
|
||||
return $summary;
|
||||
}
|
||||
|
||||
$start = $length - 1;
|
||||
|
||||
while ($start >= 0) {
|
||||
$byte = ord($summary[$start]);
|
||||
|
||||
if ($byte < 0x80 || $byte > 0xBF) {
|
||||
break;
|
||||
}
|
||||
|
||||
--$start;
|
||||
}
|
||||
|
||||
if ($start < 0) {
|
||||
return $summary;
|
||||
}
|
||||
|
||||
$lead = ord($summary[$start]);
|
||||
|
||||
if ($lead >= 0xC2 && $lead <= 0xDF) {
|
||||
$expectedLength = 2;
|
||||
} elseif ($lead >= 0xE0 && $lead <= 0xEF) {
|
||||
$expectedLength = 3;
|
||||
} elseif ($lead >= 0xF0 && $lead <= 0xF4) {
|
||||
$expectedLength = 4;
|
||||
} else {
|
||||
return $summary;
|
||||
}
|
||||
|
||||
$availableLength = $length - $start;
|
||||
|
||||
if ($availableLength >= $expectedLength) {
|
||||
return $summary;
|
||||
}
|
||||
|
||||
$sequence = substr($summary, $start).substr($lookahead, 0, $expectedLength - $availableLength);
|
||||
|
||||
if (strlen($sequence) !== $expectedLength || preg_match('//u', $sequence) !== 1) {
|
||||
return $summary;
|
||||
}
|
||||
|
||||
return substr($summary, 0, $start);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to rewind a message body and throws an exception on failure.
|
||||
*
|
||||
* The body of the message will only be rewound if a call to `tell()`
|
||||
* returns a value other than `0`.
|
||||
*
|
||||
* @param MessageInterface $message Message to rewind
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public static function rewindBody(MessageInterface $message): void
|
||||
{
|
||||
$body = $message->getBody();
|
||||
|
||||
if ($body->tell()) {
|
||||
$body->rewind();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses an HTTP message into an associative array.
|
||||
*
|
||||
* The array contains the `start-line` key containing the start line of the
|
||||
* message, `headers` key containing an associative array of header array
|
||||
* values, and a `body` key containing the body of the message.
|
||||
*
|
||||
* @param string $message HTTP request or response to parse.
|
||||
*/
|
||||
public static function parseMessage(string $message): array
|
||||
{
|
||||
return MessageParser::parseMessage($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a URI for an HTTP request message.
|
||||
*
|
||||
* The URI is composed from the start-line path and the `Host` header, using
|
||||
* `https` when the host's port is `443` and `http` otherwise. Without a
|
||||
* `Host` header, only the path is returned, with extra leading slashes
|
||||
* collapsed so an origin-form target cannot be parsed as a network-path
|
||||
* reference with its own authority. An `InvalidArgumentException` is thrown
|
||||
* when the `Host` header is invalid.
|
||||
*
|
||||
* @param string $path Path from the start-line
|
||||
* @param array $headers Array of headers (each value an array).
|
||||
*/
|
||||
public static function parseRequestUri(string $path, array $headers): string
|
||||
{
|
||||
return MessageParser::parseRequestUri($path, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a request message string into a request object.
|
||||
*
|
||||
* The request-target must be in origin form, absolute form (without a
|
||||
* userinfo component), authority form (`CONNECT`), or asterisk form
|
||||
* (`OPTIONS`), and any `Host` header must be a single valid value;
|
||||
* otherwise an `InvalidArgumentException` is thrown. Non-origin-form
|
||||
* targets are preserved on the returned request via `withRequestTarget()`.
|
||||
*
|
||||
* @param string $message Request message string.
|
||||
*/
|
||||
public static function parseRequest(string $message): RequestInterface
|
||||
{
|
||||
return MessageParser::parseRequest($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a response message string into a response object.
|
||||
*
|
||||
* @param string $message Response message string.
|
||||
*/
|
||||
public static function parseResponse(string $message): ResponseInterface
|
||||
{
|
||||
return MessageParser::parseResponse($message);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue