Article View: borland.public.cppbuilder.internet.web
Article #1105Re: IdHTTP Get exception
From: Keith
Date: Fri, 06 May 2005 14:06
Date: Fri, 06 May 2005 14:06
47 lines
2209 bytes
2209 bytes
The server reply header contains the entry:
Expires: -1
This causes the exception.
If I manually alter the buffer to:
Expires: 0\0
there is no exception when Response.ProcessHeaders;
is called from IdHTTP.pas, procedure TIdHTTPProtocol.RetrieveHeaders;
Here is what happens in IdHTTPHeaderInfo.pa, procedure
TIdEntityHeaderInfo.ProcessHeaders:
if StrToIntDef(Values['Expires'], -1) <> -1 then begin
// This is happening when expires is returned as integer number in seconds
LSecs := StrToInt(Values['Expires']);
LHours := LSecs div 3600;
LMinutes := (LSecs mod 3600) div 60;
LSecs := (LSecs mod 3600) mod 60;
FExpires := Now + EncodeTime(LHours, LMinutes, LSecs, 0);
end
else begin
FExpires := GMTToLocalDateTime(Values['Expires']); {do not localize}
end;
-------------------
GMTToLocalDateTime('-1'); will fail as it calls
function RawStrInternetToDateTime(var Value: string): TDateTime;
with pointer to -1 which causes
Result := EncodeDate(Yr, Mo, Dt); to throw exception due to invalid parameters
Dt=-1,
Mo=0, and
Yr=1900
How should these function be restructured to allow server header reply
Expires: -1
keith
Technical Details
Message-ID:
<427B79E8.824F54F1@sbcglobal.net>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<427AB1E6.60A6005E@sbcglobal.net> <427ab842$1@newsgroups.borland.com> <427AC3FE.C00C80D0@sbcglobal.net> <427b34fe$1@newsgroups.borland.com> <427B5EAC.786B8D70@sbcglobal.net>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,b8c33a2643ef426e X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit Message-ID: <427B79E8.824F54F1@sbcglobal.net> Date: Fri, 06 May 2005 09:06:32 -0500 From: Keith <kdopson@sbcglobal.net> X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.web Subject: Re: IdHTTP Get exception References: <427AB1E6.60A6005E@sbcglobal.net> <427ab842$1@newsgroups.borland.com> <427AC3FE.C00C80D0@sbcglobal.net> <427b34fe$1@newsgroups.borland.com> <427B5EAC.786B8D70@sbcglobal.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 65.71.227.85 X-Trace: newsgroups.borland.com 1115388166 65.71.227.85 (6 May 2005 07:02:46 -0700) Lines: 49 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail