Recent

Author Topic: idHTTP and DNS over HTTPS  (Read 368 times)

RDL

  • Jr. Member
  • **
  • Posts: 65
idHTTP and DNS over HTTPS
« on: November 20, 2022, 04:02:09 pm »
Hello.
I make a DoH request via curl, it works.
Code: Pascal  [Select][+][-]
  1. curl -H 'accept: application/dns-message' -k 'https://dns.yandex/dns-query?dns=AAABAAABAAAAAAAABG1haWwCcnUAAAEAAQ' | od -tcu1x1

I'm trying to make the same request through Indy, I get the message Connection Closed Gracefully.

Code: Pascal  [Select][+][-]
  1. HTTP:=TIdHTTP.Create;
  2. HTTP.HandleRedirects:=True;
  3. HTTP.IOHandler:=SSL;
  4. HTTP.Request.Accept:='application/dns-message';
  5. HTTP.Get('https://dns.yandex/dns-query?dns=AAABAAABAAAAAAAABG1haWwCcnUAAAEAAQ',hsResponseStream);
  6. HTTP.Free;

What am I doing wrong?
« Last Edit: November 20, 2022, 04:26:49 pm by RDL »
Sorry for my english, google translation!

Bogen85

  • Sr. Member
  • ****
  • Posts: 431
Re: idHTTP and DNS over HTTPS
« Reply #1 on: November 20, 2022, 05:36:59 pm »
Can you please provide a complete able to compile example?

Thaddy

  • Hero Member
  • *****
  • Posts: 12640
Re: idHTTP and DNS over HTTPS
« Reply #2 on: November 20, 2022, 05:49:16 pm »
If curl is installed, simply use libcurl, which is supported as standard.
It also works on Windows since 3.0.0. (I provided a patch, FPK commited it)
« Last Edit: November 20, 2022, 05:52:45 pm by Thaddy »
"Looks" OK, doesn't mean it is IS OK.

RDL

  • Jr. Member
  • **
  • Posts: 65
Re: idHTTP and DNS over HTTPS
« Reply #3 on: November 22, 2022, 08:21:59 am »
I have attached an example program.
To compile, you need to install Indy from this pull request https://github.com/mezen/Indy/tree/NewOpenSSL_PR

It is not clear why this request works through curl, but not through indy
« Last Edit: November 22, 2022, 08:29:22 am by RDL »
Sorry for my english, google translation!

 

TinyPortal © 2005-2018