fix(benchmark): reject --ollama-url without a host (#315)

Follow-up to #274: the merged scheme validation accepts host-less URLs (http://, https://), which then fail opaquely inside urlopen(). Add a minimal netloc check after the existing scheme check, so a missing host is rejected up front with a clear argparse error. Additive; keeps the existing scheme message intact.
This commit is contained in:
Hamza Ali Shahjahan
2026-06-26 02:28:51 +02:00
committed by GitHub
parent 7790c37b67
commit 33a4977a83
+2
View File
@@ -154,6 +154,8 @@ def main():
parsed_url = urllib.parse.urlparse(args.ollama_url) parsed_url = urllib.parse.urlparse(args.ollama_url)
if parsed_url.scheme not in ("http", "https"): if parsed_url.scheme not in ("http", "https"):
parser.error(f"Invalid --ollama-url scheme: '{parsed_url.scheme}'. Only 'http' and 'https' are supported.") parser.error(f"Invalid --ollama-url scheme: '{parsed_url.scheme}'. Only 'http' and 'https' are supported.")
if not parsed_url.netloc:
parser.error(f"--ollama-url must include a host, e.g. http://localhost:11434 (got '{args.ollama_url}').")
run(args.model, args.repeat, args.ollama_url) run(args.model, args.repeat, args.ollama_url)