Hello,

I see the code:

    if(DateTimeEdit->Text != "")
        SslHttpCli1->ModifiedSince = StrToDateTime(DateTimeEdit->Text);
    else
        SslHttpCli1->ModifiedSince = 0;

in prepareconnection(). I am not sure what to enter to DateTimeEdit as
it seems that what the server returns  as last-modified is not
accepted--at least not in my locale. What do you suggest? I recall
donating the function:

function THttpMTConnection.RFCToDateTime(S:string):TDateTime;
var
   M,D,Y:Word;
   H,N,Sc,T:Word;
   Ch,CHtag:Char;
   Ts:string;
   PosCh:integer;

begin
   posch:=Pos(';',S);
   if posch>0 then
      delete(s,posCH,length(s)-posCh+1);
   T:=0;
try
   Ch:=S[3];
except
   Result:=Now;
   Exit;
End;
   S:=Uppercase(S);
   if Ch=#32 then begin
      Delete(S,1,4);
      Ts:=Copy(S,1,Pos(#32,S)-1);
      Delete(S,1,Length(TS));
      S:=Trim(S);
      M:=Pos(TS,#32#32'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC')div 3;
      Ts:=Copy(S,1,Pos(#32,S)-1);
      Delete(S,1,Length(TS)+1);
      S:=Trim(S);
      try
         D:=StrToInt(TS);
      except
         D:=1;
      end;
      Ch:=S[3];
      if Ch<>':' then begin
         Ts:=Copy(S,1,Pos(#32,S)-1);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            Y:=StrToInt(TS);
         except
            DecodeDate(Now,Y,T,T);
            T:=0;
         end;
      end;
      Ts:=Copy(S,1,Pos(':',S)-1);
      Delete(S,1,Length(TS)+1);
      S:=Trim(S);
      try
         H:=StrToInt(TS);
      except
         H:=0;
      end;
      Ts:=Copy(S,1,2);
      Delete(S,1,Length(TS)+1);
      S:=Trim(S);
      try
         N:=StrToInt(TS);
      except
         N:=0;
      end;
      Ts:=Copy(S,1,2);
      Delete(S,1,Length(TS)+1);
      S:=Trim(S);
      try
         Sc:=StrToInt(TS);
      except
         Sc:=0;
      end;
      if S<>'' then begin
         Ch:=S[1];
         if Ch in ['0'..'9'] then begin
            try
               Y:=StrToInt(S);
            except
               DecodeDate(Now,Y,T,T);
               T:=0;
            end;
         end;
      end;
   end
   else
      if Ch=',' then begin// RFC 822 or RFC 1123
         Delete(S,1,Pos(#32,S));
         S:=Trim(S);
         Ts:=Copy(S,1,Pos(#32,S)-1);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            D:=StrToInt(TS);
         except
            D:=1;
         end;
         Ts:=Copy(S,1,Pos(#32,S)-1);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         M:=Pos(TS,#32#32'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC')div 3;
         Ts:=Copy(S,1,Pos(#32,S)-1);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            Y:=StrToInt(TS);
         except
            DecodeDate(Now,Y,T,T);
            T:=0;
         end;
         Ts:=Copy(S,1,Pos(':',S)-1);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            H:=StrToInt(TS);
         except
            H:=0;
         end;
         Ts:=Copy(S,1,2);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            N:=StrToInt(TS);
         except
            N:=0;
         end;
         Ts:=Copy(S,1,2);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            Sc:=StrToInt(TS);
         except
            Sc:=0;
         end;
      end
      else begin// RFC 850 or RFC 1036
         Delete(S,1,Pos(#32,S));
         S:=Trim(S);
         chtag:='-';
         posCh:=Pos(chtag,S);
         if (posCH>0)and(posCh<5) then
            chtag:='-'
         else
            chtag:=' ';
         Ts:=Copy(S,1,Pos(chtag,S)-1);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            D:=StrToInt(TS);
         except
            D:=1;
         end;
         Ts:=Copy(S,1,Pos(chtag,S)-1);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         M:=Pos(TS,#32#32'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC')div 3;
         Ts:=Copy(S,1,Pos(#32,S)-1);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            Y:=StrToInt(TS);
         except
            DecodeDate(Now,Y,T,T);
            T:=0;
         end;
         Ts:=Copy(S,1,Pos(':',S)-1);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            H:=StrToInt(TS);
         except
            H:=0;
         end;
         Ts:=Copy(S,1,2);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            N:=StrToInt(TS);
         except
            N:=0;
         end;
         Ts:=Copy(S,1,2);
         Delete(S,1,Length(TS)+1);
         S:=Trim(S);
         try
            Sc:=StrToInt(TS);
         except
            Sc:=0;
         end;
      end;
   if Y<100 then begin
      DecodeDate(Now,Y,T,T);
   end;
   try
      Result:=EncodeDate(Y,M,D) + EncodeTime(H,N,Sc,T);
   except
      result:=now;
   end;
end;

Why don't you use it?

Regards,

SZ
--
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

Reply via email to