Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

methodiHttpResponse.SetContentStream

procedure SetContentStream(const aStream: TStream; aOwns: Boolean);
Sets the body from a stream, from position 0 to its end. aOwns=True HANDS THE STREAM OVER: the response keeps it, the wire session reads it as it sends - nothing is copied, which is what makes a large file cheap to serve - and frees it once the response is done or the connection is gone. Do not touch it after this call, and do not free it yourself; it is a double free if anything else holds it. aOwns=False COPIES the contents, because the stream stays yours and may be gone the moment the handler returns. Passing nil is allowed and simply leaves the body empty.