hildjj / dohdec

Lookup and decode DNS records using DNS-over-HTTPS (DoH)
MIT License
19 stars 5 forks source link

How to use POST method in dohdec-cli ? #43

Closed PaTTeeL closed 6 hours ago

PaTTeeL commented 1 year ago

How to trigger the dohdec-cli uses POST request for getting response from DoH servers ? I saw the option Options: -g, --get Force http GET for DNS-format lookups (default: true)

and tried all the ways as below:

dohdec -dv www.cloudflare.com aaaa
dohdec -dv www.cloudflare.com aaaa -g 0
dohdec -dv www.cloudflare.com aaaa -g false

the program always shows

DNSoverHTTPS options: {
  contentType: 'application/dns-message',
  http2: true,
  preferPost: false,
  url: 'https://cloudflare-dns.com/dns-query',
  userAgent: 'dohdec v5.0.3'
}
...
HTTP GET URL: https://cloudflare-dns.com/dns-query?dns=AAABAAABAAAAAAABA3d3dwpjbG91ZGZsYXJlA2NvbQAAHAABAAApEAAAAAAAAFEADABNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

So how can I make dohdec-cli use the POST method to get the response from DoH servers?

hildjj commented 12 hours ago

This turned out to be a bug in the CLI. WillFix.

hildjj commented 8 hours ago

Once this is fixed, you'll want to use the -d flag as well. I think you have to ask for DNS-formatted responses if you use POST.