{"record":{"id":"da7b410cbfcd26b7","repo":"sgl-project/sglang","slug":"including-the-scheme-in-host-host-is-depre","errorCode":null,"errorMessage":"Including the scheme in --host ('{host}') is deprecated. Pass just the hostname (e.g. '127.0.0.1') instead.","messagePattern":"Including the scheme in --host \\('(.+?)'\\) is deprecated\\. Pass just the hostname \\(e\\.g\\. '127\\.0\\.0\\.1'\\) instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"python/sglang/utils.py","lineNumber":166,"sourceCode":"    with open(filename, mode) as fout:\n        for i, s in enumerate(states):\n            if isinstance(s, str):\n                pass\n            elif isinstance(s, ProgramState):\n                s = s.text()\n            else:\n                s = str(s)\n\n            fout.write(\n                \"=\" * 40 + f\" {i} \" + \"=\" * 40 + \"\\n\" + s + \"\\n\" + \"=\" * 80 + \"\\n\\n\"\n            )\n\n\ndef normalize_base_url(host: str, port: int) -> str:\n    from sglang.srt.utils.network import NetworkAddress\n\n    if host.startswith(\"http://\") or host.startswith(\"https://\"):\n        warnings.warn(\n            f\"Including the scheme in --host ('{host}') is deprecated. \"\n            f\"Pass just the hostname (e.g. '127.0.0.1') instead.\",\n            DeprecationWarning,\n            stacklevel=2,\n        )\n        return f\"{host}:{port}\"\n    return NetworkAddress(host, port).to_url()\n\n\nclass HttpResponse:\n    def __init__(self, resp):\n        self.resp = resp\n\n    @cached_property\n    def _body(self):\n        return self.resp.read()\n\n    def json(self):","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/utils.py#L148-L184","documentation":"In sglang/test_utils-style helpers, normalize_base_url warns with DeprecationWarning when the host string starts with http:// or https://. The function now expects a bare hostname; including the scheme changes URL semantics (double scheme in constructed URLs) so callers must pass just the host and the scheme is added by the caller/URL builder.","triggerScenarios":"Calling normalize_base_url(host=\"http://127.0.0.1\", port=30000) (or https). Used by test helpers (test_concurrent, test_streaming), run_eval, select_sglang_backend, and ipv4/ipv6 host tests — so any of these with a scheme-prefixed --host triggers it.","commonSituations":"Copy-pasting a full URL from a browser/curl into --host; test scripts or eval harnesses written against an older signature that accepted schemes; IPv6 hosts like http://::1.","solutions":["Pass the bare hostname: normalize_base_url('127.0.0.1', port) instead of 'http://127.0.0.1'","If you need a full URL afterwards, build it explicitly: f\"http://{normalize_base_url(host, port)}/health\"","grep test/eval scripts for 'http://' inside host arguments"],"exampleFix":"# before\nbase = normalize_base_url(\"http://127.0.0.1\", 30000)\n# after\nbase = normalize_base_url(\"127.0.0.1\", 30000)\nurl = f\"http://{base}/health\"","handlingStrategy":"validation","validationCode":"host = host.removeprefix(\"https://\").removeprefix(\"http://\")\nbase = normalize_base_url(host, port)","typeGuard":"def is_bare_host(h: str) -> bool: return not (h.startswith(\"http://\") or h.startswith(\"https://\"))","tryCatchPattern":null,"preventionTips":["Never paste full URLs into host parameters","Centralize URL construction in one helper that takes host/port/scheme separately"],"tags":["url","deprecation","host-config","networking","tests"],"backgroundTag":"deprecated-api-rename","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}