Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Oct : Re: Delphi2007, Indy10, TidHttp, site returns 500 but has content

www.cryer.info
Managed Newsgroup Archive

Re: Delphi2007, Indy10, TidHttp, site returns 500 but has content

Subject:Re: Delphi2007, Indy10, TidHttp, site returns 500 but has content
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Fri, 12 Oct 2007 16:18:17

"dk_sz" <dk_sz@hotmail.com> wrote in message
news:470fc97d@newsgroups.borland.com...

> Sample code.

The "Result" and "Response.ContentStream" are pointing to the same TStream
object.  The TStream you pass to Get() gets assigned to the
Response.ContentStream property.  So you are copying an empty TStream back
into itself.

To access the real error data, you need to catch an EIdHTTPProtocolException
exception and then read its ErrorMessage property.  For example:

    try
        FHTTP.Get(AURI, Result);
    except
        on E: EIdHTTPProtocolException do
        begin
            // use E.ErrorCode, E.Message, and E.ErrorMessage properties as
needed...
        end;
        on E: Exception do
        begin
            // a non-HTTP error occured, do something else...
        end;
    end;

> If website returns reponse code 500, an exception
> is thrown, and there is no way to get content.

Yes, there is.  You are simply looking in the wrong place for it.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive