Exception reading HTTP response content

Hi,

Occasionally I have encountered a Sparkle exception error when trying to read the content of the response from a HTTP call.  The latest error I got is :

HttpEngine Error
Could not read complete entity body. Content-length: 2384; Bytes read: 0

I can see this is raised in the THttpResponse.GetContentAsBytes function in Sparkle.Http.Engine.pas unit.  So it seems the TStream.Read method has failed to read any bytes.  Do you have any tips/suggestions as to what causes this, and is there any way to guard against?

Many thanks,
Jonathan

Hi Jonathan,

It looks the server is returning a wrong content-length header? The content-length header is 2384, but the response doesn't have any body (size 0).
How is the server implementation of that request?

Hi Wagner,

I've solved it - I should have paid closer attention to the HTTP status code!  The server I'm calling is Amazon's AWS SES email service, but I didn't realise the network my app is running on has a proxy server which requires authentication and it was returning 407.

Thanks,
Jonathan