Re: Writing a back-to-back HTTP Server plus HTTP Client for stream data?

Giganews Newsgroups
Subject: Re: Writing a back-to-back HTTP Server plus HTTP Client for stream data?
Posted by:  Remy Lebeau \(Indy Team\) (no.spam@no.spam.com)
Date: Sun, 19 Apr 2009

"AndrewFG" <…@bb.com> wrote in message news:C756D1742C7EE340…@bb.com...

> I think the starting point is to use an TIdHTTPServer, and in its
> OnCommandGet, I would create a local TIdHTTPClient to
> fetch the data.

Yes.

> I think this would work so long as the amount of Content data is
> small: it seems to me that the local TIdHTTPClient must download
> all the requested data to its memory during the server's OnCommandGet,
> and only after all data has been read, can it return from OnCommandGet,
> and thus release the data to the calling client.

That is one way to do it.

Other option is to use a TIdTCPClient (not a TIdHTTP) to send a request to
the other server and read back just its reply headers, then create a
TIdTCPStream that is attached to the TIdTCPClient.IOHandler, and assign the
stream to the AResponseInfo.ContentStream property.  When TIdHTTPServer
reads from the stream while writing data to the client, it would actually be
reading the data from the secondary connection.

--
Remy Lebeau (TeamB)

Replies

In response to

Writing a back-to-back HTTP Server plus HTTP Client for stream data? posted by AndrewFG on Sun, 19 Apr 2009