Re: [Doh] A question on the mix of DNS and HTTP semantics

Tony Finch <> Sun, 18 March 2018 10:11 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 9BA791200A0 for <>; Sun, 18 Mar 2018 03:11:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -4.2
X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham autolearn_force=no
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 8i2h9tE92HLW for <>; Sun, 18 Mar 2018 03:11:57 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id C26201275F4 for <>; Sun, 18 Mar 2018 03:11:43 -0700 (PDT)
X-Cam-AntiVirus: no malware found
Received: from ([]:38244) by ( []:25) with esmtps (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1exVHy-000exR-eF (Exim 4.89_2) (return-path <>); Sun, 18 Mar 2018 10:11:42 +0000
Date: Sun, 18 Mar 2018 10:11:41 +0000
From: Tony Finch <>
To: Ted Hardie <>
In-Reply-To: <>
Message-ID: <>
References: <>
User-Agent: Alpine 2.11 (DEB 23 2013-08-11)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset="US-ASCII"
Archived-At: <>
Subject: Re: [Doh] A question on the mix of DNS and HTTP semantics
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: DNS Over HTTPS <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Sun, 18 Mar 2018 10:11:59 -0000

Yesterday at the IETF 101 Hakathon I was working on a DoH server. I've
written up some notes at for
those who might be interested.

I was going to send this as a separate thread, but it's basically the same
topic as Ted's message, so I'm sending it as a reply. The approach I have
taken is basically Ted's option (2). The rest of this message is what I
wrote before reading Ted's note...

One of the questions I bumped into was what kind of HTTP errors my
server should generate. I have had another quick look through the
draft but I couldn't see anything particularly addressing this issue.
So here are some sketchy suggestions.

In the following I say "browser-friendly" to mean `text/html` or
`text/plain` or something like that, but definitely not

If the request is not HEAD/GET/POST, I return 405 Method Not Allowed
with a browser-friendly body.

For POST requests with an unknown Content-Type, or GET requests with
an unknown or missing `ct=` parameter, my server returns 415
Unsupported Media Type with a browser-friendly body.

If the `dns=` parameter is missing from a GET request, the best
response seems to be a browser-friendly 400 Bad Request. Sam Kington
(not an IETFer afaik) suggested 422 Unprocessable Entity, but that
implies the request is well-formed which isn't really the case. (My
server returns 418 I'm A Teapot for fun.) Bad `base64url` encoding
should produce the same response.

If the request's Accept: header doesn't allow
`application/dns-udpwireformat` then the response should be a
browser-friendly 406 Not Acceptable.

I think if the request passes these checks, the server knows it has a
request in DNS format and a client that wants a response in DNS
format, so it can just hand over to its DNS processing code.
Regardless of the DNS RCODE in the response, the HTTP status code
should be 200 OK.

My logic up to this point is to send a browser-friendly response if
the client seems to be unprepared to talk to a DoH server. There are
some other cases - e.g. HTTP authentication or redirects - which ought
to be handled by the HTTP layers before the request processing gets to
the DoH logic, so in these cases the response bodies will naturally be
browser-friendly. But perhaps it's worth noting them in the draft so
that DoH clients should be prepared to handle them gracefully.

f.anthony.n.finch  <>  -  I xn--zr8h punycode
Dover, Wight, Portland, Plymouth: Northeast, becoming cyclonic in Portland and
Plymouth, 6 to gale 8. Moderate or rough. Occasional snow. Moderate or good,
occasionally very poor.