Re: [twsocket] FTPCli problem.
OK, after another series of tests it turned out that I have no idea what the problem is. The user could find out that: - using a passive connection to transfer any file of a certain size (maybe larger than 38Mb but maybe 37.Mb) causes a failure under unknown conditions (the ftp client hangs). That remind me a site where a bluecoat system was installed. Bluecoat was configured to scan for virus any file passing thru, even zipped files which where unzipped. unfortunately Bluecoat failed with a certain size of file and as seen from the user, the transfer failed. Once that Bluecoat feature was turned off, everything went OK. I sent your OverbyteIcsFtpTst.exe from the 7th version package to test it on that damn computer and it also fails. Besides, it seems to have a bug: there seems to be no way to initiate binary transfer. It always opens ASCII transfer, even if binary checkbox is checked: You have to click on the TypeSet button which send the command to the FTP server with the checkbox value as parameter. Same as you have to do by code ! -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- 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] ClientDisconnect problem
That is the real problem why socket connection is disconnect. automatically Please read again my first answer and answer all the questions I aksed and follow the advice I gave. By the way, is this problem related to the previous problem you asked questions for ? If yes, please answer the questions I asked then. If not, tell us how you solved it be like to have feedback ! -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- 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] FTPCli problem.
Hello Francois, OK, after another series of tests it turned out that I have no idea what the problem is. The user could find out that: - using a passive connection to transfer any file of a certain size (maybe larger than 38Mb but maybe 37.Mb) causes a failure under unknown conditions (the ftp client hangs). I sent your OverbyteIcsFtpTst.exe from the 7th version package to test it on that damn computer and it also fails. Besides, it seems to have a bug: there seems to be no way to initiate binary transfer. It always opens ASCII transfer, even if binary checkbox is checked: < 150 Opening ASCII mode data connection for ocb.exe Thursday, February 3, 2011, 11:03:36 PM, you wrote: FP>> Is it confirmed that the server actually send the 226 answer and this is FP>> lost because the client doesn't see it ? >> By the moment the software was tested with 2 servers, and the behavior >> is the same. We could think that the router is the problem, but the >> only unexplained thing remained is why ICS5 works... FP> I understood that, but nevertheless, I would like to confirm the server send FP> the 226 answer when the download is done. It is possible that something is FP> wrong at the closing of the data connection and so the server never send his FP> 226 status, or the server send it but ICS doesn't get it. FP> So before continuing with guessing, I would like to know the answer to my FP> question, because this is the next thing I would check myself if I had that FP> problem. FP> You said you reproduced the issue with your own server being interrogated, FP> so it should be easy for you to spy on the network at your own server and FP> see if the 226 answer is properly sent with his ending CR/LF. FP> Regards, FP> -- FP> francois.pie...@overbyte.be FP> The author of the freeware multi-tier middleware MidWare FP> The author of the freeware Internet Component Suite (ICS) FP> http://www.overbyte.be FP> -- FP> To unsubscribe or change your settings for TWSocket mailing list FP> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket FP> Visit our website at http://www.overbyte.be -- Best regards, Antolmailto:spama...@mail.ru -- 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] ClientDisconnect problem
That is the real problem why socket connection is disconnect. automatically On Sun, Feb 13, 2011 at 12:48 AM, Francois PIETTE wrote: > Server some time shows the following exception >> not connected (#10057 in Send) >> > > This happen when you try to send something after the client is > disconnected. > > > -- > francois.pie...@overbyte.be > The author of the freeware multi-tier middleware MidWare > The author of the freeware Internet Component Suite (ICS) > http://www.overbyte.be > > -- > 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 > -- 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] Modifying headers before send in httpcli fails
only 1 line SHeader := 'Authorization: OAuth oauth_callback="oob", realm="", oauth_nonce="' + nonce + '", oauth_timestamp="' + tstamp + '", oauth_consumer_key="' + ConsumerKey + '", oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_signature="' + URLEncode2(sign) +'"'; On Sun, Feb 13, 2011 at 3:35 AM, RTT wrote: > On 12-02-2011 22:31, brian - wrote: > >> Authorization: OAuth oauth_callback="oob", realm="", >> oauth_nonce="5B2407849960FC2B4EC23007EA63E8ED", >> oauth_timestamp="1297549627", oauth_consumer_key="5BZYtiAzGvQTL0ZEhAn45w", >> oauth_signature_method="HMAC-SHA1", oauth_version="1.0", >> oauth_signature="RjpaedDdvs6n9yX1TFI%2FNzrnbcQ%3D" >> > Are you sending these options in only one header line (the "Authorization" > one) , or multiple lines as this dump suggest? > > -- > 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 > -- 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] Modifying headers before send in httpcli fails
On 12-02-2011 22:31, brian - wrote: Authorization: OAuth oauth_callback="oob", realm="", oauth_nonce="5B2407849960FC2B4EC23007EA63E8ED", oauth_timestamp="1297549627", oauth_consumer_key="5BZYtiAzGvQTL0ZEhAn45w", oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_signature="RjpaedDdvs6n9yX1TFI%2FNzrnbcQ%3D" Are you sending these options in only one header line (the "Authorization" one) , or multiple lines as this dump suggest? -- 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] Modifying headers before send in httpcli fails
Oh yeah, dunno why I thought that was read only >< same effect anyway, the output headers are the same and still OAuth fails. Maybe something to do with the way httpcli sends the headers? On Sat, Feb 12, 2011 at 11:42 PM, RTT wrote: > On 12-02-2011 22:31, brian - wrote: > >> there's no option in httpcli to manually modify the headers >> before a request >> > > You can do it from the OnBeforeHeaderSend event. > -- > 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 > -- 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] Modifying headers before send in httpcli fails
On 12-02-2011 22:31, brian - wrote: there's no option in httpcli to manually modify the headers before a request You can do it from the OnBeforeHeaderSend event. -- 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
[twsocket] Modifying headers before send in httpcli fails
Hi, I've been working on Twitter's OAuth implementation, for which I'm using THttpCli. There are various ways to do this, one of which is adding some Auth data in the http headers and not including the parameters int he GET call. However, there's no option in httpcli to manually modify the headers before a request, so I did a tiny modification on OverbyteIcsHttpProt as follows: 587: THttpCli = class(TIcsWndControl) protected FExtraSendHeader : String; 913: published property ExtraSendHeader : Stringread FExtraSendHeader write FExtraSendHeader; 2406: if FExtraSendHeader <> '' then begin Headers.Add(FExtraSendHeader); FExtraSendHeader := ''; end; I tested this with an event, which seems to be set properly: procedure TForm1.UpdatesSocketBeforeHeaderSend(Sender: TObject; const Method: string; Headers: TStrings); begin memo1.lines.Add(Headers.Text); end; so I fire my Get, and the headers all look correct: URL = http://api.twitter.com/oauth/request_token GET /oauth/request_token HTTP/1.0 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* User-Agent: Mozilla/4.0 (compatible; ICS) Host: api.twitter.com Authorization: OAuth oauth_callback="oob", realm="", oauth_nonce="5B2407849960FC2B4EC23007EA63E8ED", oauth_timestamp="1297549627", oauth_consumer_key="5BZYtiAzGvQTL0ZEhAn45w", oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_signature="RjpaedDdvs6n9yX1TFI%2FNzrnbcQ%3D" However, this always fails with "Failed to validate oauth signature and token". I made sure the data is 100% correct. If I use the parameters in the URL instead, it works just fine, so they are correct. Any ideas? anywhere else in the code where the added headers might not be going through? For reference: http://oauth.net/core/1.0/#auth_header -- 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] ClientDisconnect problem
Server some time shows the following exception not connected (#10057 in Send) This happen when you try to send something after the client is disconnected. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- 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] ClientDisconnect problem
Server some time shows the following exception not connected (#10057 in Send) On Sat, Feb 12, 2011 at 9:23 PM, Francois PIETTE wrote: > I am using the TWSocket component as client and server . Server is >> sending >> data regularly @ 3000 bytes/seconds . But client is disconnnect after >> some time ( 2 or ,3 or 4 minutes ) frequently . There is no ping break >> between them .why it is happening. >> > > Assuming you are using TCP... > Maybe bad network or buggy security product or bug in your software or > Do you have any error code or exception ? > Do you know if the client disconnect from server or server disconnect > client ? > If you don't know, you may discover it using WireShark, a free network > sniffer. Using it, you'll find which side is sending the close session > packet. > > Try your software between two PC on the same subnetwork on the same LAN. > > -- > francois.pie...@overbyte.be > The author of the freeware multi-tier middleware MidWare > The author of the freeware Internet Component Suite (ICS) > http://www.overbyte.be > > -- > 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 > -- 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] ClientDisconnect problem
I am using the TWSocket component as client and server . Server is sending data regularly @ 3000 bytes/seconds . But client is disconnnect after some time ( 2 or ,3 or 4 minutes ) frequently . There is no ping break between them .why it is happening. Assuming you are using TCP... Maybe bad network or buggy security product or bug in your software or Do you have any error code or exception ? Do you know if the client disconnect from server or server disconnect client ? If you don't know, you may discover it using WireShark, a free network sniffer. Using it, you'll find which side is sending the close session packet. Try your software between two PC on the same subnetwork on the same LAN. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- 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
[twsocket] ClientDisconnect problem
Hi, I am using the TWSocket component as client and server . Server is sending data regularly @ 3000 bytes/seconds . But client is disconnnect after some time ( 2 or ,3 or 4 minutes ) frequently . There is no ping break between them .why it is happening. -- 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] TFtpCli strange logic
GetWinsockOrProxyErrorStr(ErrCode); // <== New function, not related to this fix I would name this function GetErrorMsgFromErrorCode since it is a general translation from an error number to a message. IMO, from the name it should be clear what range of error numbers are expected to be translated. Maybe "GetWinsockOrProxyErrorMsgFromErrorCode". Indeed, but then when another range is created, a new function has to be created as well. No a good idea IMO. Better to have a general purpose function to translate any error code to a message. We could also imagine an optional argument with a set of message ranges to check, defaulting to all ranges. Probably the implementation should as well call the API to get Windows error message description from Windows error code. Won't the API return localized messages? Probably. FormatMessage (http://msdn.microsoft.com/en-us/library/ms679351(v=VS.85).aspx) has a dwLanguageId argument but probably most Windows do not have all languages installed. Maybe english messages are always there ? Not nice to have different languages in log files or error messages. Agreed. But difficult to reach in a real application involving a lot of components/libraries anyway. generic. We still have the problem of colliding error code which exists since the beginning. Can't this be solved by introducing a range reserved for component users? And by introducing a global unit containing all those constants used by ICS which might lead to conflicts, that would help us a lot to keep overview? I found for instance SmtpProtocolError = 20600 in SmtpProt.pas yesterday. According to windows documentation (http://msdn.microsoft.com/en-us/library/ms681381(v=vs.85).aspx), system error code are in the range 0-15999. So the error number I selected long time ago doesn't collide with Windows. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- 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] TFtpCli strange logic
Francois PIETTE wrote: >>GetWinsockOrProxyErrorStr(ErrCode); // <== New function, not >> related to this fix > > I would name this function GetErrorMsgFromErrorCode since it is a > general translation from an error number to a message. IMO, from the name it should be clear what range of error numbers are expected to be translated. Maybe "GetWinsockOrProxyErrorMsgFromErrorCode". > Probably the > implementation should as well call the API to get Windows error > message description from Windows error code. Won't the API return localized messages? Not nice to have different languages in log files or error messages. > generic. We still have the problem of colliding error code which > exists since the beginning. Can't this be solved by introducing a range reserved for component users? And by introducing a global unit containing all those constants used by ICS which might lead to conflicts, that would help us a lot to keep overview? I found for instance SmtpProtocolError = 20600 in SmtpProt.pas yesterday. -- Arno Garrels > This way it is perfectly > generic. We still have the problem of colliding error code which > exists since the beginning. > > -- > francois.pie...@overbyte.be > The author of the freeware multi-tier middleware MidWare > The author of the freeware Internet Component Suite (ICS) > http://www.overbyte.be > > > - Original Message - > From: "Arno Garrels" > To: "ICS support mailing" > Sent: Saturday, February 12, 2011 10:41 AM > Subject: Re: [twsocket] TFtpCli strange logic > > >> Francois PIETTE wrote: 1) Command Open succeeds. 2) After the server received command User it closes the connection (FIN/ACK). 3) OnSessionClosed triggers with ErrCode 0. 4) OnRequestDone triggers with ErrCode 0 and the status code from previous request. Would you agree that is a bug? >>> >>> If the server closes the connection as a reaction to a command >>> except quit, then OnrequestDone should report a failure code, >>> probably WSAECONNRESET. >> >> Do you see anything obviously wrong in this fix? >> >> >> procedure TCustomFtpCli.ControlSocketSessionClosed( >>Sender : TObject; >>ErrCode : Word); >> var >>LClosedState : TFtpState; >> begin >>LClosedState := FState; >>if FConnected then begin >>FConnected := FALSE; >>if FState <> ftpAbort then >>StateChange(ftpNotConnected); >>if Assigned(FOnSessionClosed) then >>FOnSessionClosed(Self, ErrCode); >>end; >>if FState <> ftpAbort then >>StateChange(ftpInternalReady); >>if FRequestType <> ftpRqAbort then begin >>if (ErrCode <> 0) or ((FRequestType <> ftpQuitAsync) and >> //<== (LClosedState in [ftpWaitingBanner, >> ftpWaitingResponse])) then >> begin //<== >>FLastResponse := '500 Control connection closed - ' + >> GetWinsockOrProxyErrorStr(ErrCode); // >> <== New function, not related to this fix >>FStatusCode:= 500; >>FRequestResult := FStatusCode;{ 06 apr 2002 } >>SetErrorMessage; >>end; >>TriggerRequestDone(FRequestResult); >>end; >> end; >> >> >> -- >> Arno Garrels >> -- >> 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 -- 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] TFtpCli strange logic
Do you see anything obviously wrong in this fix? I Don't. GetWinsockOrProxyErrorStr(ErrCode); // <== New function, not related to this fix I would name this function GetErrorMsgFromErrorCode since it is a general translation from an error number to a message. Probably the implementation should as well call the API to get Windows error message description from Windows error code. This way it is perfectly generic. We still have the problem of colliding error code which exists since the beginning. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be - Original Message - From: "Arno Garrels" To: "ICS support mailing" Sent: Saturday, February 12, 2011 10:41 AM Subject: Re: [twsocket] TFtpCli strange logic Francois PIETTE wrote: 1) Command Open succeeds. 2) After the server received command User it closes the connection (FIN/ACK). 3) OnSessionClosed triggers with ErrCode 0. 4) OnRequestDone triggers with ErrCode 0 and the status code from previous request. Would you agree that is a bug? If the server closes the connection as a reaction to a command except quit, then OnrequestDone should report a failure code, probably WSAECONNRESET. Do you see anything obviously wrong in this fix? procedure TCustomFtpCli.ControlSocketSessionClosed( Sender : TObject; ErrCode : Word); var LClosedState : TFtpState; begin LClosedState := FState; if FConnected then begin FConnected := FALSE; if FState <> ftpAbort then StateChange(ftpNotConnected); if Assigned(FOnSessionClosed) then FOnSessionClosed(Self, ErrCode); end; if FState <> ftpAbort then StateChange(ftpInternalReady); if FRequestType <> ftpRqAbort then begin if (ErrCode <> 0) or ((FRequestType <> ftpQuitAsync) and //<== (LClosedState in [ftpWaitingBanner, ftpWaitingResponse])) then begin //<== FLastResponse := '500 Control connection closed - ' + GetWinsockOrProxyErrorStr(ErrCode); // <== New function, not related to this fix FStatusCode:= 500; FRequestResult := FStatusCode;{ 06 apr 2002 } SetErrorMessage; end; TriggerRequestDone(FRequestResult); end; end; -- Arno Garrels -- 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 -- 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] Send and Shutdown oddity
Markus Humm wrote: > My application now has to tell the communication part (means the > server side of the TWSocket connection) to shut down. it sends him a > binary shutdown command and after a short time the client does a > shutdown(1) on the socket. There's most likely something wrong in your application logic. When the server receives your custom shutdown command it should stop listening first, send an OK-response back to the requesting client and disconnect all client connections. On the client-side after sending your custom shutdown command, receive the OK response and subsequently either Close the connection actively or wait for the server to close the connection. However with "wait" I do of course _not_ mean "wait in some loop", OnSessionClosed fire on connection close. -- Arno Garrels -- 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] TFtpCli strange logic
Francois PIETTE wrote: >> 1) Command Open succeeds. >> 2) After the server received command User it closes the connection >> (FIN/ACK). >> 3) OnSessionClosed triggers with ErrCode 0. >> 4) OnRequestDone triggers with ErrCode 0 and the status code from >> previous request. >> >> Would you agree that is a bug? > > If the server closes the connection as a reaction to a command except > quit, then OnrequestDone should report a failure code, probably > WSAECONNRESET. Do you see anything obviously wrong in this fix? procedure TCustomFtpCli.ControlSocketSessionClosed( Sender : TObject; ErrCode : Word); var LClosedState : TFtpState; begin LClosedState := FState; if FConnected then begin FConnected := FALSE; if FState <> ftpAbort then StateChange(ftpNotConnected); if Assigned(FOnSessionClosed) then FOnSessionClosed(Self, ErrCode); end; if FState <> ftpAbort then StateChange(ftpInternalReady); if FRequestType <> ftpRqAbort then begin if (ErrCode <> 0) or ((FRequestType <> ftpQuitAsync) and //<== (LClosedState in [ftpWaitingBanner, ftpWaitingResponse])) then begin //<== FLastResponse := '500 Control connection closed - ' + GetWinsockOrProxyErrorStr(ErrCode); // <== New function, not related to this fix FStatusCode:= 500; FRequestResult := FStatusCode;{ 06 apr 2002 } SetErrorMessage; end; TriggerRequestDone(FRequestResult); end; end; -- Arno Garrels -- 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] TFtpCli strange logic
1) Command Open succeeds. 2) After the server received command User it closes the connection (FIN/ACK). 3) OnSessionClosed triggers with ErrCode 0. 4) OnRequestDone triggers with ErrCode 0 and the status code from previous request. Would you agree that is a bug? If the server closes the connection as a reaction to a command except quit, then OnrequestDone should report a failure code, probably WSAECONNRESET. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- 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