mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-11 10:22:40 +00:00
Cleanup
This commit is contained in:
parent
d4802bcdb6
commit
12fe786a2f
1 changed files with 5 additions and 3 deletions
|
@ -45,9 +45,9 @@ class URL {
|
|||
}
|
||||
$out = strtolower($scheme)."://";
|
||||
if (strlen($u ?? "")) {
|
||||
$out .= self::normalizePart(rawurlencode($u), self::P_USER, false);
|
||||
$out .= self::normalizePart(rawurlencode($u), self::P_USER);
|
||||
if (strlen($p ?? "")) {
|
||||
$out .= ":".self::normalizePart(rawurlencode($p), self::P_PASS, false);
|
||||
$out .= ":".self::normalizePart(rawurlencode($p), self::P_PASS);
|
||||
}
|
||||
$out .= "@";
|
||||
} elseif (strlen($user ?? "")) {
|
||||
|
@ -66,11 +66,13 @@ class URL {
|
|||
return $out;
|
||||
}
|
||||
|
||||
protected static function normalizePart(string $part, int $type, bool $passthrough_encoded = true): string {
|
||||
/** Perform percent-encoding normalization for a given URL component */
|
||||
protected static function normalizePart(string $part, int $type): string {
|
||||
// stub
|
||||
return $part;
|
||||
}
|
||||
|
||||
/** Normalizes a hostname per IDNA:2008 */
|
||||
protected static function normalizeHost(string $host): string {
|
||||
$idn = idn_to_ascii($host, \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46);
|
||||
return $idn !== false ? idn_to_utf8($idn, \IDNA_NONTRANSITIONAL_TO_UNICODE, \INTL_IDNA_VARIANT_UTS46) : $host;
|
||||
|
|
Loading…
Reference in a new issue