🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TIdHTTPResponseInfo WriteContent (or not)

#1
From: Wim Bekker
Date: Thu, 10 Jul 2008 21:57
35 lines
2093 bytes
Remy Lebeau (TeamB) schreef:

> WriteContent() is called automatically after the OnCommandGet event handler 
> exits, if the handler did send the response headers yet.

Thanks for your answer and it raises some other questions:

How do I know if the response headers are sent yet? I assume that if I 
always call WriteContent, I'm sure that it is send.


At one point I check for the head:
   if (AnsiSameText(RequestInfo->Command, "HEAD"))
     HandleHead(LocalDoc,ResponseInfo);
   else
     HandleNormalDoc(LocalDoc,AThread,RequestInfo, ResponseInfo);

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?



If LocalDoc doesn't exists, I do:
   ResponseInfo->ResponseNo = 404; // - Not Found

I noticed that if I leave the WriteContent out, the result is a blank 
page. If I do WriteContent, I receive a small 404 Not found message. In 
this case I do have to manually call WriteContent shouldn't I?


Wim
Technical Details
Message-ID: <4876859d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!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>

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
Date: Thu, 10 Jul 2008 23:57:10 +0200
From: Wim Bekker <wim....@.....nl>
User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: TIdHTTPResponseInfo WriteContent (or not)  
References: <4875e25d$1@newsgroups.borland.com> <48763b07$1@newsgroups.borland.com>
In-Reply-To: <48763b07$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 83.86.39.252
Message-ID: <4876859d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1215727005 83.86.39.252 (10 Jul 2008 14:56:45 -0700)
Lines: 35
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail