From: Remi Gacogne Date: Fri, 6 Jan 2023 10:56:34 +0000 (+0100) Subject: dnsdist: Set a proper HTTP error code on Proxy Protocol failure X-Git-Tag: dnsdist-1.8.0-rc1~123^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fb4ab9457ec855f263209dceeb0d5086ced0dc9c;p=thirdparty%2Fpdns.git dnsdist: Set a proper HTTP error code on Proxy Protocol failure --- diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 0b6aa516f3..9f76591b5a 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -1460,7 +1460,7 @@ bool assignOutgoingUDPQueryToBackend(std::shared_ptr& ds, uint1 } } catch (const std::exception& e) { - vinfolog("Adding proxy protocol payload to %squery from %s failed: %s", (dq.ids.du ? "DoH" : ""), dq.ids.origDest.toStringWithPort(), e.what()); + vinfolog("Adding proxy protocol payload to %s query from %s failed: %s", (dq.ids.du ? "DoH" : ""), dq.ids.origDest.toStringWithPort(), e.what()); return false; } } diff --git a/pdns/dnsdistdist/doh.cc b/pdns/dnsdistdist/doh.cc index b66836b367..fd993a25d1 100644 --- a/pdns/dnsdistdist/doh.cc +++ b/pdns/dnsdistdist/doh.cc @@ -678,7 +678,8 @@ static void processDOHQuery(DOHUnitUniquePtr&& unit) ComboAddress dest = dq.ids.origDest; if (!assignOutgoingUDPQueryToBackend(downstream, htons(queryId), dq, du->query, dest)) { - sendDoHUnitToTheMainThread(std::move(du), "DoH internal error"); + du->status_code = 500; + sendDoHUnitToTheMainThread(std::move(du), "DoH internal error"); return; } }