Hello, In the demo, in the function prepareconnection, you get the if-modified-since date from a text box and then supply it to StrToDateTime. When I put a date like,
13 May 2009, 14:23:45 GMT or any date that is returned from last-modified header of responses from the web, there is an exception raised--"cannot convert". This function takes a string of the same format and returns a TDateTime value of it. I am not sure if the error happens on other locales but this is the case here (TR). Also, did you get my one previous message that contains a url to a screenshot? I think that is more important right now. Thanks, SZ On 5/26/09, Francois Piette <[email protected]> wrote: > Could you produce a clear explanation of the issue you are faced with > instead of publishing long code no one has time to read ? > -- > [email protected] > Author of ICS (Internet Component Suite, freeware) > Author of MidWare (Multi-tier framework, freeware) > http://www.overbyte.be > > ----- Original Message ----- > From: "Fastream Technologies" <[email protected]> > To: "ICS support mailing" <[email protected]> > Sent: Tuesday, May 26, 2009 2:15 PM > Subject: Re: [twsocket] C++ THttpsTst demo code problem > > > > Hello, > > > > I believe there _might_ be a problem with Httpstst/Thttpcli 304 > > responses with no "connection" response header. However due to the > > problem below, I am unable to test with the demos. Hope somebody could > > help. > > > > Regards, > > > > SZ > > > > On 5/25/09, Fastream Technologies <[email protected]> wrote: > > > 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
