You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Misc. bug: URL query is parsed into the host when the URL has no path #28400
common_http_parse_url() in common/http.h splits the authority from the path by searching for the first /:
auto slash_pos = rest.find('/');
RFC 3986 ends the authority at the first /, ? or #, so a URL that carries a query but no path never terminates the authority. For https://example.com?download=1 the parser produces:
host -> example.com?download=1 path -> /
Two things then go wrong in common_http_client(), which builds the httplib::Client out of parts.host: the connection is attempted against a hostname that cannot resolve, and the query string is dropped from the request even if it could.
This parser is shared, so the same failure reaches every HTTP caller in the tree: common/download.cpp (-mu / --model-url and remote GGUF fetches), common/hf-cache.cpp, tools/cli/cli-client.cpp, and the server CORS proxy in tools/server/server-cors-proxy.h.
Query-only URLs are ordinary and commonly machine-generated, signed download links, CDN cache-busting parameters, and ?download=1-style flags, so this is hit by real endpoints rather than only by malformed input.
Suggested fix:
End the authority at the first / or ? (rest.find_first_of("/?")) and keep the remainder, leading ? included, as the request path, which is what httplib expects. A # fragment could be handled the same way, though it is not part of what is sent on the wire.
Activity
parveshsaini commentedon Sep 4, 2026
Suggested fix:
End the authority at the first
/or?(rest.find_first_of("/?")) and keep the remainder, leading?included, as the request path, which is what httplib expects. A#fragment could be handled the same way, though it is not part of what is sent on the wire.Happy to pick this up and raise a quick PR 🚀
github-actions commentedon Oct 19, 2026
This issue was closed because it has been inactive for 14 days since being marked as stale.