🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #2

Re: TIdHTTPResponseInfo WriteContent (or not)

#2
From: Remy Lebeau (TeamB)
Date: Thu, 10 Jul 2008 22:44
41 lines
2429 bytes
"Wim Bekker" <wim....@.....nl> wrote in message 
news:4876859d@newsgroups.borland.com...

> How do I know if the response headers are sent yet?

The TIdHTTPResponseInfo::HeaderHasBeenWritten property, which is set by 
WriteHeader().

Generally, you shouldn't worry about calling WriteContent() manually.  Just 
set the response properties and let the server send the response 
automatically.

> In HandleHead, I do:
> ResponseInfo->ContentType = GetMIMEType(LocalDoc);
> ResponseInfo->WriteHeader();
>
> After this, OnCommandGet exists (without serving the file).
> Is this correct? Does it do WriteContent?

After OnCommandGet exits, WriteHeader() is called if HeaderHasBeenWritten is 
false, and WriteContent() is called if there is any value assigned to the 
ContentText or ContentStream property.

> I noticed that if I leave the WriteContent out, the result is a blank 
> page.

Because no data is being sent to the client at all, other than the headers.

> If I do WriteContent, I receive a small 404 Not found message.

If ContentText and ContentStream() are both empty, then WriteContent() sends 
a small HTML page containing just the ResponseNo and ResponseText values.

> In this case I do have to manually call WriteContent shouldn't I?

If you assign the ContentText or ContentStream, then WriteContent() is 
called automatically.


Gambit 
Technical Details
Message-ID: <48769116$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!eweka.nl!lightspeed.eweka.nl!newsfeeder.wxs.nl!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4875e25d$1@newsgroups.borland.com> <48763b07$1@newsgroups.borland.com> <4876859d@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,849e342dec50f01
X-Google-Attributes: gid11508e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <4875e25d$1@newsgroups.borland.com> <48763b07$1@newsgroups.borland.com> <4876859d@newsgroups.borland.com>
Subject: Re: TIdHTTPResponseInfo WriteContent (or not)  
Date: Thu, 10 Jul 2008 15:44:13 -0700
Lines: 43
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 207.178.157.90
Message-ID: <48769116$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1215729942 207.178.157.90 (10 Jul 2008 15:45:42 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!eweka.nl!lightspeed.eweka.nl!newsfeeder.wxs.nl!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail