st3fan / tinydoh

Minimal DNS-Over-HTTPS Server
Mozilla Public License 2.0
131 stars 6 forks source link

Hard coded "A" query? #3

Open lojikil opened 6 years ago

lojikil commented 6 years ago

https://github.com/st3fan/tinydoh/blob/0b51cf6c47466691dc76a6ef8fc023e117101f41/main.go#L96

I apologize if this is just me misunderstand the DoH draft, but is a protocol restriction to have the "A" query hardcoded here?

(I'm happy to figure it out, implement, and PR, I just wanted to make sure that I'm not misunderstanding something. Reading Protocol documents before coffee at 0500 local is not a good look for me...)

Thanks!

st3fan commented 6 years ago

No, I actually think this is incorrect. The specification does not say anything about specific queries, it just says to forward the query as-is. This hard coded query works for Firefox because it only requests A (and AAAA).

We should probably revisit that code.

lojikil commented 6 years ago

I think it can follow the same pattern as the POST section, no?

  1. Base64 unencode the parameter
  2. decode the DNS message
  3. split out t and n from the message

I can try that & issue a PR if that works, fair?