<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Thank you Michael for pointing me to the headers - the problem
      was indeed the missing headers.<br>
    </p>
    <div class="moz-cite-prefix">INDY sends these 2 headers
      automatically:<br>
         
      Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8<br>
          User-Agent=Mozilla/3.0 (compatible; Indy Library)</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">When I add both of them to
      TFPHTTPClient, I get a valid response (both are needed). I only
      used "FPC/3.1 (Free Pascal Compiler)" for the user-agent instead
      of the INDY one :)<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Best<br>
      Ondrej</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 01.07.2019 17:59, Ondrej Pokorny
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:4bce0b09-2933-0015-e136-c9132c16b3aa@kluug.net">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Thank you Michael for the response. I'll check what headers
        INDY sends.</p>
      <p>Ondrej<br>
      </p>
      <p><br>
      </p>
      <div class="moz-cite-prefix">On 01.07.2019 14:57, Michael Van
        Canneyt wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:alpine.DEB.2.21.1907011445330.19412@home"> <br>
        I tested: <br>
        <br>
        If I run a strace, it just hangs on the read operation: <br>
        <br>
        connect(3, {sa_family=AF_INET, sin_port=htons(80),
        sin_addr=inet_addr("128.30.52.100")}, 16) = -1 EINPROGRESS
        (Operation now in progress) <br>
        select(4, NULL, [3], NULL, {tv_sec=3, tv_usec=0}) = 1 (out [3],
        left {tv_sec=2, tv_usec=884913}) <br>
        getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 <br>
        fcntl(3, F_GETFL)                       = 0x802 (flags
        O_RDWR|O_NONBLOCK) <br>
        fcntl(3, F_SETFL, O_RDWR)               = 0 <br>
        sendto(3, "GET /TR/2002/REC-xmldsig-core-20"..., 112, 0, NULL,
        0) = 112 <br>
        recvfrom(3, <br>
        <br>
        If I do the same with 'wget' it also hangs but in the end gets
        through.. <br>
        <br>
        But if you add some headers, you get a proper error response. <br>
        <br>
        There is little I can do about that. I can only surmise Indy
        & wget send different <br>
        headers (E.G.user-agent) and the server reacts differently on
        that. <br>
        <br>
        <br>
        <br>
        Michael. <br>
        <br>
        On Mon, 1 Jul 2019, Ondrej Pokorny wrote: <br>
        <br>
        <blockquote type="cite">Hello, <br>
          <br>
          I cannot download
          <a class="moz-txt-link-freetext"
href="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"
            moz-do-not-send="true">http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd</a>
          with TFPHTTPClient. Delphi INDY downloads it just fine. Does
          anybody know what I am missing? <br>
          <br>
          Test code: <br>
          <br>
          program Project1; <br>
          uses Classes, SysUtils, fphttpclient; <br>
          procedure DownloadFile(const aURI: string; out outStream:
          TStream); <br>
          var <br>
            xClient: TFPHTTPClient; <br>
          begin <br>
            outStream := nil; <br>
            xClient := TFPHTTPClient.Create(nil); <br>
            try <br>
              xClient.AllowRedirect := True; <br>
              outStream := TMemoryStream.Create; <br>
              xClient.Get(aURI, outStream); <br>
              outStream.Position := 0; <br>
            except <br>
              on E: Exception do <br>
              begin <br>
                FreeAndNil(outStream); <br>
                Writeln(E.ClassName); <br>
                Writeln(E.Message); <br>
              end; <br>
            end; <br>
            xClient.Free; <br>
          end; <br>
          var <br>
            S: TStream; <br>
          begin <br>
          DownloadFile('<a class="moz-txt-link-freetext"
href="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"
            moz-do-not-send="true">http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd</a>',
          S); <br>
            S.Free; <br>
            Readln; <br>
          end. <br>
          <br>
          Fails with exception: <br>
          <br>
          EHTTPClient <br>
          Error reading data from socket <br>
          <br>
          #0 fpc_raiseexception(0x145fb14, 0x0, 0xffffffff) at
          ..\inc\except.inc:158 <br>
          #1 FILLBUFFER(0x145fb14) at
          fcl-web\src\base\fphttpclient.pp:731 <br>
          #2 READSTRING(0x15e1c30, 0x0) at
          fcl-web\src\base\fphttpclient.pp:749 <br>
          #3 READRESPONSEHEADERS(0x15e1c30) at
          fcl-web\src\base\fphttpclient.pp:854 <br>
          #4 READRESPONSE(0x15e1c30, 0x15b5dc0, 0x145fdb8, 0, false) at
          fcl-web\src\base\fphttpclient.pp:1132 <br>
          #5 DONORMALREQUEST(0x15e1c30, {PROTOCOL = 0x15b5e4c 'http',
          USERNAME = 0x0, PASSWORD = 0x0, HOST = 0x15b5ecc '<a
            class="moz-txt-link-abbreviated" href="http://www.w3.org"
            moz-do-not-send="true">www.w3.org</a>', PORT = 0, PATH =
          0x1601c9c '/TR/2002/REC-xmldsig-core'..., DOCUMENT = 0x15bc58c
          'xmldsig-core-schema.xsd', PARAMS = 0x0, BOOKMARK = 0x0,
          HASAUTHORITY = true}, 0x449d58 'GET', 0x15b5dc0, 0x145fdb8, 0,
          false, false) at fcl-web\src\base\fphttpclient.pp:1226 <br>
          #6 DOMETHOD(0x15e1c30, 0x449d58 'GET', 0x443060 '<a
            class="moz-txt-link-freetext"
            href="http://www.w3.org/TR/2002" moz-do-not-send="true">http://www.w3.org/TR/2002</a>'...,
          0x15b5dc0, 0x145fdb8, 0) at
          fcl-web\src\base\fphttpclient.pp:1283 <br>
          #7 HTTPMETHOD(0x15e1c30, 0x449d58 'GET', 0x443060 '<a
            class="moz-txt-link-freetext"
            href="http://www.w3.org/TR/2002" moz-do-not-send="true">http://www.w3.org/TR/2002</a>'...,
          0x15b5dc0, 0x145fdb8, 0) at
          fcl-web\src\base\fphttpclient.pp:1397 <br>
          #8 GET(0x15e1c30, 0x443060 '<a class="moz-txt-link-freetext"
            href="http://www.w3.org/TR/2002" moz-do-not-send="true">http://www.w3.org/TR/2002</a>'...,
          0x15b5dc0) at fcl-web\src\base\fphttpclient.pp:1439 <br>
          #9 DOWNLOADFILE(0x443060 '<a class="moz-txt-link-freetext"
            href="http://www.w3.org/TR/2002" moz-do-not-send="true">http://www.w3.org/TR/2002</a>'...,
          0x15b5dc0) at project1.lpr:14 <br>
          #10 main at project1.lpr:30 <br>
          <br>
          Ondrej <br>
          <br>
          _______________________________________________ <br>
          fpc-devel maillist  -  <a class="moz-txt-link-abbreviated"
            href="mailto:fpc-devel@lists.freepascal.org"
            moz-do-not-send="true">fpc-devel@lists.freepascal.org</a> <br>
          <a class="moz-txt-link-freetext"
            href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel"
            moz-do-not-send="true">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
          <br>
          <br>
        </blockquote>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org" moz-do-not-send="true">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel" moz-do-not-send="true">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
    </blockquote>
  </body>
</html>