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>
83 lines
3 KiB
Markdown
83 lines
3 KiB
Markdown
# URI and MIME Helpers
|
|
|
|
This page covers small helper methods for redacting URI user info, converting
|
|
values into URI objects, and resolving MIME types from filenames or extensions.
|
|
For URI resolution, normalization, and comparison helpers, see
|
|
[URI Helpers](uri-helpers.md).
|
|
|
|
## `GuzzleHttp\Psr7\Utils::redactUserInfo`
|
|
|
|
`public static function redactUserInfo(UriInterface $uri): UriInterface`
|
|
|
|
Redact the user info part of a URI.
|
|
|
|
Returns the URI with the whole userinfo component replaced by `***` when one
|
|
is present, so neither the username nor the password survives into logs and
|
|
diagnostics. A URI without userinfo is returned unchanged.
|
|
|
|
## `GuzzleHttp\Psr7\Utils::redactUserInfoInString`
|
|
|
|
`public static function redactUserInfoInString(string $subject, string $uri): string`
|
|
|
|
Redacts the userinfo of a raw URI string wherever it appears in a subject
|
|
string.
|
|
|
|
The needle is taken verbatim from the raw URI rather than from parsed
|
|
components, so credentials that URI normalization would rewrite, such as raw
|
|
control bytes or unencoded reserved characters, are still found in text that
|
|
embeds the URI exactly as given, for example transport error messages. A URI
|
|
without `://` is treated as authority-form: a host and port with optional
|
|
userinfo.
|
|
|
|
A URI that does not parse has no trustworthy authority boundary, so everything
|
|
between any scheme and its last `@` is redacted as a safe-side fallback.
|
|
|
|
## `GuzzleHttp\Psr7\Utils::redactUriForMessage`
|
|
|
|
`public static function redactUriForMessage(UriInterface $uri): string`
|
|
|
|
Formats a URI for automatic diagnostics.
|
|
|
|
The whole userinfo component is replaced by "***", and the query and
|
|
fragment are removed. The scheme, host, port, and path are preserved.
|
|
The returned string is diagnostic-escaped and the formatter never
|
|
throws.
|
|
|
|
## `GuzzleHttp\Psr7\Utils::redactUriStringForMessage`
|
|
|
|
`public static function redactUriStringForMessage(string $uri): string`
|
|
|
|
Formats a raw URI for automatic diagnostics, including malformed input.
|
|
|
|
The whole userinfo component is replaced by "***", and the query and
|
|
fragment are removed. The scheme, host, port, and path are preserved
|
|
where their boundaries can be determined safely. The returned string is
|
|
diagnostic-escaped and the formatter never throws.
|
|
|
|
## `GuzzleHttp\Psr7\Utils::uriFor`
|
|
|
|
`public static function uriFor(string|UriInterface $uri): UriInterface`
|
|
|
|
Returns a `UriInterface` for the given value.
|
|
|
|
This function accepts a string or `UriInterface` and returns a `UriInterface`
|
|
for the given value. If the value is already a `UriInterface`, it is returned
|
|
as-is.
|
|
|
|
## `GuzzleHttp\Psr7\MimeType::fromFilename`
|
|
|
|
`public static function fromFilename(string $filename): string|null`
|
|
|
|
Determines the MIME type of a file by looking at its extension.
|
|
|
|
## `GuzzleHttp\Psr7\MimeType::fromExtension`
|
|
|
|
`public static function fromExtension(string $extension): string|null`
|
|
|
|
Maps a file extension to a MIME type.
|
|
|
|
## Related
|
|
|
|
- [URI Helpers](uri-helpers.md)
|
|
- [Header and Query Helpers](header-and-query-helpers.md)
|
|
- [Stream Helpers](stream-helpers.md)
|