fix(app): a one-word address is refused at once; this machine's is reached over HTTP
An address of one word (`todo`) was read as https://todo/ and looked for, the person waiting up to 15 s for no instance to answer. A host is now a domain of two labels or more, an IP address or localhost; anything else is "This isn't an address." as it is typed. localhost and loopback addresses typed without a scheme are reached over HTTP, as a server running on the same machine has no certificate; HTTPS where typed (the developer's review, 9 Nov 2026). Whats-New: An address of a single word is now refused at once, rather than looked for. Whats-New-De: Eine Adresse aus nur einem Wort wird jetzt sofort abgelehnt, statt danach zu suchen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
8ffaf731c7
commit
f7341922e5
1 changed files with 74 additions and 8 deletions
|
|
@ -24,6 +24,31 @@ void main() {
|
|||
);
|
||||
});
|
||||
|
||||
test('reaches this machine over HTTP where no scheme is typed, as a '
|
||||
"server running on it has no certificate (the developer's review, "
|
||||
'9 Nov 2026)', () {
|
||||
for (final (address, url) in [
|
||||
('localhost:8080', 'http://localhost:8080/'),
|
||||
('LOCALHOST', 'http://localhost/'),
|
||||
('127.0.0.1:8080', 'http://127.0.0.1:8080/'),
|
||||
('[::1]:8080', 'http://[::1]:8080/'),
|
||||
('https://localhost:8443', 'https://localhost:8443/'),
|
||||
]) {
|
||||
expect(Instance.parse(address)?.url, Uri.parse(url), reason: address);
|
||||
}
|
||||
});
|
||||
|
||||
test('takes an IP address as a host', () {
|
||||
expect(
|
||||
Instance.parse('192.168.1.10:8080')?.url,
|
||||
Uri.parse('https://192.168.1.10:8080/'),
|
||||
);
|
||||
expect(
|
||||
Instance.parse('http://[2001:db8::1]')?.url,
|
||||
Uri.parse('http://[2001:db8::1]/'),
|
||||
);
|
||||
});
|
||||
|
||||
test('refuses what is no address', () {
|
||||
for (final address in [
|
||||
'',
|
||||
|
|
@ -32,6 +57,13 @@ void main() {
|
|||
'ftp://example.org',
|
||||
'https://',
|
||||
'https://someone@example.org',
|
||||
// A host of one word that isn't this machine, which no instance on
|
||||
// the internet has: refused as typed rather than looked for
|
||||
// (the developer's review, 9 Nov 2026).
|
||||
'todo',
|
||||
'https://learn',
|
||||
'learn.',
|
||||
'.org',
|
||||
]) {
|
||||
expect(Instance.parse(address), isNull, reason: address);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue