Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TIdHTTPResponseInfo WriteContent (or not)

32 views
Skip to first unread message

wim.b...@casema.nl

unread,
Jul 10, 2008, 6:06:57 AM7/10/08
to
Hi, I've created a webserver that servers pages and binaries etc. All
works well, but I'm confused about the usage of WriteContent. Do I
need to call this, or is it automatically called? It seems that
without, the responses are also correct. Without diving into Indy10
myself, maybe anyone can shed some light on it?

Thanks in advance, WimB.


example, in serverCommandGet:

TMemoryStream* MemoryStream = new TMemoryStream();
MemoryStream->LoadFromFile(....->LocalDoc);

HttpRequest->ResponseInfo->FreeContentStream = true;
HttpRequest->ResponseInfo->ResponseNo = 200;
HttpRequest->ResponseInfo->ContentType = ContentType;
HttpRequest->ResponseInfo->ContentLength = (int)MemoryStream-
>Size;
HttpRequest->ResponseInfo->ContentStream = MemoryStream;
HttpRequest->ResponseInfo->WriteContent;

works fine, and:

TStringList* StringList = new TStringList();
StringList->LoadFromFile(HttpRequest->LocalDoc);
HttpRequest->Content = StringList->Text;
delete StringList;

AnsiString ContentText = ReplaceDivaTags(HttpRequest);
HttpRequest->ResponseInfo->ResponseNo = 200;
HttpRequest->ResponseInfo->ContentType = ContentType;
HttpRequest->ResponseInfo->ContentText = ContentText;
HttpRequest->ResponseInfo->ContentLength = ContentText.Length();

also works fine.

0 new messages