-1

I am having trouble getting Indy to return upon certain URLS and I am not sure what is going on. I have some very simple test code to return the URL that I want and drop the HTML into a TMemo.

With IdHTTP Do
Begin
  s := Get(txtURL.Text);
  txtOutput.Lines.Add('-------' + sLineBreak + sLineBreak + s);
End;

Yet when I try it with this url :- http://nuediamonds.com/synthetic_diamond_rings.php it never returns and just locks. I added an OnWork event but all I saw in there was that the content length was always -1

Does anyone have any ideas please, I am desperately in need of solving this.

Regards Anthoni

Anthoni Gardner
  • 929
  • 1
  • 9
  • 17

1 Answers1

1

The URL you showed works fine for me using the current Indy 10 SVN snapshot. It does not get stuck.

As for why the ContentLength property is -1, that happens when there is no Content-Length header present. That can happen for one of several reasons:

  1. a Transfer-Encoding header is present and specifies a chunked encoding is being used. Chunked data is self-terminating.

  2. a Content-Type header is present specifying MIME multipart/... data is being sent, such as multipart/byteranges. MIME is self-terminating.

  3. the HTTP response is terminated by having the server close the connection.

Refer to RFC 2616 Section 4.4 "Message Length". for more details.

Community
  • 1
  • 1
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • I am having trouble knowing which Indy to grab. I am using the following url :- https://svn.atozed.com:444/svn/Indy10 I can see 10.6.0 XE4 but nothing for XE3. Do I grab the 10.6 version even for XE3? BTW: I am using the Indy version that came built in XE3 – Anthoni Gardner Sep 02 '13 at 18:51
  • Yes, grab the latest. It supports Delphi versions all the way back to D5. And make sure you read the [installation instructions](http://www.indyproject.org/Sockets/Docs/Indy10Installation.EN.aspx). – Remy Lebeau Sep 02 '13 at 19:37
  • Hi Remy, deleted my previous comment. I did not read the document properly and still had some files under the /lib folder. I have it now fully installed and up to date. Tried my test program and still locking :( [Indy 10.6.0.0] – Anthoni Gardner Sep 02 '13 at 20:51
  • Like I said, the code and URL you showed works fine for me when I use the latest Indy. When I call `TIdHTTP.Get('http://nuediamonds.com/synthetic_diamond_rings.php')`, it does not freeze up and does exit as expected. Can you update your question with an [SSCCE](http://sscce.org) demonstrating the problem? Or, at least, can you provide a Wireshark or `TIdLog...` capture of the HTTP traffic when `TIdHTTP` freezes for you? Maybe the HTTP server is sending a different response to me than it is sending to you, and maybe the response to you is malformed or is confusing `TIdHTTP` in some way. – Remy Lebeau Sep 02 '13 at 21:52
  • Pah! I created a new test for the SSCCE and guess what, it goes and works lol – Anthoni Gardner Sep 02 '13 at 21:59