ipn/ipnlocal: improve dohQuery error to suggest ?dns= and ?q= (#16056)

Previously, a missing or invalid `dns` parameter on GET `/dns-query`
returned only “missing ‘dns’ parameter”. Now the error message guides
users to use `?dns=` or `?q=`.

Updates: #16055

Signed-off-by: Zach Buchheit <zachb@tailscale.com>
This commit is contained in:
Zach Buchheit 2025-05-23 14:17:28 -07:00 committed by GitHub
parent 00a7dd180a
commit 4a11514db5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -859,7 +859,7 @@ func dohQuery(r *http.Request) (dnsQuery []byte, publicErr string) {
case "GET":
q64 := r.FormValue("dns")
if q64 == "" {
return nil, "missing 'dns' parameter"
return nil, "missing dns parameter; try '?dns=' (DoH standard) or use '?q=<name>' for JSON debug mode"
}
if base64.RawURLEncoding.DecodedLen(len(q64)) > maxQueryLen {
return nil, "query too large"