Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top