Compare commits

...

2 Commits

Author SHA1 Message Date
Xavier Roche
75c735c960 Pin why the bracketed origin is rejected, not just that it is
Asserting only the failure and an empty sent buffer is a weak signal: a
stricter host validator (say, LDH-only) would reject these too, for the
wrong reason, and pass. Checking the message keeps the assertion tied to
the IPv6 case; a substring, so the wording stays free.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
2026-07-16 17:58:48 +02:00
Xavier Roche
6781f73469 Cover the SOCKS5 IPv6-literal origin reject
The CONNECT request is always ATYP=domain, so socks5_handshake_stream rejects
a bracketed origin rather than send the brackets as a domain name the proxy
could never resolve. Nothing pinned that branch; drop the reject and the suite
still passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
2026-07-16 17:58:48 +02:00

View File

@@ -1510,6 +1510,22 @@ static int st_socks5(httrackp *opt, int argc, char **argv) {
assertf(io.sent_len == 0);
}
/* the request is always ATYP=domain, which cannot carry an IPv6 literal: a
bracketed origin is rejected rather than sent as a bogus domain name. The
msg check pins the reason: a stricter host validator would also reject
these, but for the wrong cause. */
io.reply = script;
io.reply_len = len;
assertf(socks5_handshake_scripted(opt, "[::1]", proxy, &io) == 0);
assertf(io.sent_len == 0);
assertf(strstr(io.msg, "IPv6") != NULL);
io.reply = script;
io.reply_len = len;
assertf(socks5_handshake_scripted(opt, "[2001:db8::1]:8443", proxy, &io) ==
0);
assertf(io.sent_len == 0);
assertf(strstr(io.msg, "IPv6") != NULL);
printf("socks5 self-test OK\n");
return 0;
}