Re: [twsocket] RFC1123_Date
Arno wrote: >> there is a bug in OverbyteIcsHttpSrv.pas in function FileDate > > Here's a fix, if you confirm that it works I'll check it in soon > (borrowed from code in OverbyteIcsFtpSrvT.pas) : Oops don't use that, its POSIX part was wrong, I just checked in a fix for both V7 and the IPv6/FireMonkey Beta, please check. It is available via SVN now or included in the next nightly snapshot ZIP. http://wiki.overbyte.be/wiki/index.php/ICS_Download -- Arno -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] RFC1123_Date
> there is a bug in OverbyteIcsHttpSrv.pas in function FileDate Here's a fix, if you confirm that it works I'll check it in soon (borrowed from code in OverbyteIcsFtpSrvT.pas) : function FileDate(FileName : String) : TDateTime; var SearchRec : TSearchRec; Status: Integer; {$IFDEF MSWINDOWS} LInt64: Int64; const FileTimeBase = -109205.0; // days between years 1601 and 1900 FileTimeStep: Extended = 24.0 * 60.0 * 60.0 * 1000.0 * 1000.0 * 10.0; // 100 nsec per Day {$ENDIF} begin Status := FindFirst(FileName, faAnyFile, SearchRec); try if Status <> 0 then Result := 0 else {$IFDEF MSWINDOWS} Move(SearchRec.FindData.ftLastWriteTime, LInt64, SizeOf(LInt64)); Result := (LInt64 / FileTimeStep) + FileTimeBase; {$ENDIF} {$IFDEF POSIX} Result := OverbyteIcsUtils.IcsDateTimeToUTC(SearchRec.TimeStamp); {$ENDIF} finally FindClose(SearchRec); end; end; -- Arno -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] RFC1123_Date
Yep. Just change the line Result := _FileDateToDateTime(SearchRec.Time); to Result := _FileDateToDateTime(SearchRec.FindData.ftLastWriteTime); The correct fix should be Result := _FileDateToDateTime(_FileTimeToDosDateTime(SearchRec.FindData.ftLastWriteTime)); ... function _FileTimeToDosDateTime(ft:TFileTime):Integer; begin SysUtils.FileTimeToDosDateTime(ft, LongRec(result).Hi,LongRec(result).Lo); end; -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] RFC1123_Date
Last-Modified: header should always be displayed time as GMT or UTC Not an HTTP imposition. As long it's a valid http-date, it's fine. There is only the need to use the same convention when sending, and comparing these dates. However, there is a bug in OverbyteIcsHttpSrv.pas in function FileDate which is returning the local time stamp of the file, not the GMT/UTC time stamp. I'll fix it next week. Yep. Just change the line Result := _FileDateToDateTime(SearchRec.Time); to Result := _FileDateToDateTime(SearchRec.FindData.ftLastWriteTime); -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] RFC1123_Date
and in THttpConnection.SendDocument(const CustomHeaders : String) : Header := Header + 'Last-Modified: ' + RFC1123_Date(FLastModified) + ' GMT' + #13#10; 'GMT' is always displayed, but is it really the time on the computer that execute the soft ? Maybe I missed something that's why I ask you all These lines are all correct, the Last-Modified: header should always be displayed time as GMT or UTC, which is the file time stamp used by Windows since NT. However, there is a bug in OverbyteIcsHttpSrv.pas in function FileDate which is returning the local time stamp of the file, not the GMT/UTC time stamp. I'll fix it next week. Angus Ok thanks for the details ;) -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] RFC1123_Date
> and in THttpConnection.SendDocument(const CustomHeaders : String) : > Header := Header + 'Last-Modified: ' + RFC1123_Date(FLastModified) > + ' GMT' + #13#10; > > 'GMT' is always displayed, but is it really the time on the > computer that execute the soft ? Maybe I missed something that's > why I ask you all These lines are all correct, the Last-Modified: header should always be displayed time as GMT or UTC, which is the file time stamp used by Windows since NT. However, there is a bug in OverbyteIcsHttpSrv.pas in function FileDate which is returning the local time stamp of the file, not the GMT/UTC time stamp. I'll fix it next week. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be