[twsocket] Need help with THttpCli
Hello, We want to reuse THttpCli after a request ends (either aborted or normal) in a MR HTTP reverse proxy. We also want to reuse non-aborted sockets so as to keep the socket open in another repository thread. Here is my logic: I first override, void __fastcall httpClient::StateChange(THttpState NewState) { if(!httpServerClient || httpServerClient->skipHTTPClientEvents) int tester = 10; else THttpCli::StateChange(NewState); } //--- void __fastcall httpClient::SetReady() { if(!httpServerClient || httpServerClient->beganDetach || httpServerClient->responseEnded) StateChange(httpReady); else THttpCli::SetReady(); } //--- void __fastcall httpClient::TriggerRequestDone() { if(!httpServerClient || httpServerClient->beganDetach || httpServerClient->responseEnded) { if(FOnRequestDone) THttpCli::FOnRequestDone(this, FRequestType, FRequestDoneError); } else THttpCli::TriggerRequestDone(); } //--- so that no more messages post after ThreadDetach();. Then I check for whether THttpCli is aborted. If it is aborted, I check if it is still connected (HTTPClient->Connected). If so, I simply delay ThreadDetach until OnSessionClosed. If not I simply abort(); and then ThreadDetach(). Now the problem is THttpCli is so much unstable in closing, it acts very unpredictably! When I reattach in another client, I mostly see it is not really threaddetach'ed! (That is after threaddetach, GetHandle is called somewhere) or sometimes the delayed threaddetach does not work. Francois, we would be happy to pay you the 70Euros/hr for 2 hours if you could write a stable reuse routine for THttpCli (and we will be donating the code). Best Regards, SZ -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Need help with THttpCli reuse after abort()
> I am not sure how I can > demostrate this to you and open to ideas... Create a small test client (Delphi code please) which on a button click use the head method to query something from the HTTP srv component into a test server application (probably a modified WebServ demo) to have the head command be very slow so that the client part can easily abort it in the middle. The client application has a second button which do a get after the abort and show it is not working. Single stepping the get method will show why it doesn't work as expected and then we can design a fix. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: "Fastream Technologies" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Tuesday, August 29, 2006 8:00 PM Subject: Re: [twsocket] Need help with THttpCli reuse after abort() > Unfortunately it turned out that it is still buggy and reusing of > ThttpCli::HEADAsync is problematic after an abort. I am not sure how I can > demostrate this to you and open to ideas... > > Best Regards, > > SZ > > - Original Message - > From: "Fastream Technologies" <[EMAIL PROTECTED]> > To: "ICS support mailing" > Sent: Tuesday, August 29, 2006 7:12 PM > Subject: Re: [twsocket] Need help with THttpCli reuse after abort() > > > : Hi, > : > : I found out that calling cleanrcvdstreams() and cleansentstreams() > killed > : the problem. FYI, I also called InternalClear() after each abort. > : > : Thanks, > : > : SZ > : > : P. S. Francois, I see that my first private message has been received by > you > : but my second reply message is again bounced... Strange, isn't it?! > : > : - Original Message - > : From: "Fastream Technologies" <[EMAIL PROTECTED]> > : To: "ICS support mailing" > : Sent: Tuesday, August 29, 2006 10:55 AM > : Subject: Re: [twsocket] Need help with THttpCli reuse after abort() > : > : > :: Hello, > :: > :: I really think the problem is with the HEAD command and component reuse > :: after abort(). It works fine with GET but for the cache validation, we > : need > :: the HEAD first. > :: > :: Hope you can help, > :: > :: SubZero > :: > :: - Original Message - > :: From: "Fastream Technologies" <[EMAIL PROTECTED]> > :: To: "ICS support mailing" > :: Sent: Tuesday, August 29, 2006 10:30 AM > :: Subject: [twsocket] Need help with THttpCli reuse after abort() > :: > :: > ::: Hello, > ::: > ::: As you know I am coding a reverse proxy. In my proxy, I am keeping > HTTP > ::: CLIENT connections open after a request so that the next request does > not > ::: wait for the establishment. Now, when something goes wrong (i.e. > socket > ::: error), I abort the client connection as well to reset the internal > state > ::: machine. However, when I do so, in the next request, (which needs to > :: reopen > ::: the socket) it stalls at SocketDataAvailable. It goes to > : httpwaitingheader > ::: part but reads data instead of header and cannot find the #10 so > exits. > :: This > ::: was not the case when we did not have a cache and did not feel the > need > : to > ::: send HEAD command before GET. Now it stalls at HEAD!! > ::: > ::: Any idea? > ::: > ::: Best Regards, > ::: > ::: SZ > ::: > ::: -- > ::: To unsubscribe or change your settings for TWSocket mailing list > ::: please goto http://www.elists.org/mailman/listinfo/twsocket > ::: Visit our website at http://www.overbyte.be > :: > :: -- > :: To unsubscribe or change your settings for TWSocket mailing list > :: please goto http://www.elists.org/mailman/listinfo/twsocket > :: Visit our website at http://www.overbyte.be > : > : -- > : To unsubscribe or change your settings for TWSocket mailing list > : please goto http://www.elists.org/mailman/listinfo/twsocket > : Visit our website at http://www.overbyte.be > > -- > To unsubscribe or change your settings for TWSocket mailing list > please goto http://www.elists.org/mailman/listinfo/twsocket > Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Need help with THttpCli reuse after abort()
Unfortunately it turned out that it is still buggy and reusing of ThttpCli::HEADAsync is problematic after an abort. I am not sure how I can demostrate this to you and open to ideas... Best Regards, SZ - Original Message - From: "Fastream Technologies" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Tuesday, August 29, 2006 7:12 PM Subject: Re: [twsocket] Need help with THttpCli reuse after abort() : Hi, : : I found out that calling cleanrcvdstreams() and cleansentstreams() killed : the problem. FYI, I also called InternalClear() after each abort. : : Thanks, : : SZ : : P. S. Francois, I see that my first private message has been received by you : but my second reply message is again bounced... Strange, isn't it?! : : - Original Message - : From: "Fastream Technologies" <[EMAIL PROTECTED]> : To: "ICS support mailing" : Sent: Tuesday, August 29, 2006 10:55 AM : Subject: Re: [twsocket] Need help with THttpCli reuse after abort() : : :: Hello, :: :: I really think the problem is with the HEAD command and component reuse :: after abort(). It works fine with GET but for the cache validation, we : need :: the HEAD first. :: :: Hope you can help, :: :: SubZero :: :: - Original Message - :: From: "Fastream Technologies" <[EMAIL PROTECTED]> :: To: "ICS support mailing" :: Sent: Tuesday, August 29, 2006 10:30 AM :: Subject: [twsocket] Need help with THttpCli reuse after abort() :: :: ::: Hello, ::: ::: As you know I am coding a reverse proxy. In my proxy, I am keeping HTTP ::: CLIENT connections open after a request so that the next request does not ::: wait for the establishment. Now, when something goes wrong (i.e. socket ::: error), I abort the client connection as well to reset the internal state ::: machine. However, when I do so, in the next request, (which needs to :: reopen ::: the socket) it stalls at SocketDataAvailable. It goes to : httpwaitingheader ::: part but reads data instead of header and cannot find the #10 so exits. :: This ::: was not the case when we did not have a cache and did not feel the need : to ::: send HEAD command before GET. Now it stalls at HEAD!! ::: ::: Any idea? ::: ::: Best Regards, ::: ::: SZ ::: ::: -- ::: To unsubscribe or change your settings for TWSocket mailing list ::: please goto http://www.elists.org/mailman/listinfo/twsocket ::: Visit our website at http://www.overbyte.be :: :: -- :: To unsubscribe or change your settings for TWSocket mailing list :: please goto http://www.elists.org/mailman/listinfo/twsocket :: Visit our website at http://www.overbyte.be : : -- : To unsubscribe or change your settings for TWSocket mailing list : please goto http://www.elists.org/mailman/listinfo/twsocket : Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Need help with THttpCli reuse after abort()
Hi, I found out that calling cleanrcvdstreams() and cleansentstreams() killed the problem. FYI, I also called InternalClear() after each abort. Thanks, SZ P. S. Francois, I see that my first private message has been received by you but my second reply message is again bounced... Strange, isn't it?! - Original Message - From: "Fastream Technologies" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Tuesday, August 29, 2006 10:55 AM Subject: Re: [twsocket] Need help with THttpCli reuse after abort() : Hello, : : I really think the problem is with the HEAD command and component reuse : after abort(). It works fine with GET but for the cache validation, we need : the HEAD first. : : Hope you can help, : : SubZero : : - Original Message - : From: "Fastream Technologies" <[EMAIL PROTECTED]> : To: "ICS support mailing" : Sent: Tuesday, August 29, 2006 10:30 AM : Subject: [twsocket] Need help with THttpCli reuse after abort() : : :: Hello, :: :: As you know I am coding a reverse proxy. In my proxy, I am keeping HTTP :: CLIENT connections open after a request so that the next request does not :: wait for the establishment. Now, when something goes wrong (i.e. socket :: error), I abort the client connection as well to reset the internal state :: machine. However, when I do so, in the next request, (which needs to : reopen :: the socket) it stalls at SocketDataAvailable. It goes to httpwaitingheader :: part but reads data instead of header and cannot find the #10 so exits. : This :: was not the case when we did not have a cache and did not feel the need to :: send HEAD command before GET. Now it stalls at HEAD!! :: :: Any idea? :: :: Best Regards, :: :: SZ :: :: -- :: To unsubscribe or change your settings for TWSocket mailing list :: please goto http://www.elists.org/mailman/listinfo/twsocket :: Visit our website at http://www.overbyte.be : : -- : To unsubscribe or change your settings for TWSocket mailing list : please goto http://www.elists.org/mailman/listinfo/twsocket : Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Need help with THttpCli reuse after abort()
Hello, I really think the problem is with the HEAD command and component reuse after abort(). It works fine with GET but for the cache validation, we need the HEAD first. Hope you can help, SubZero - Original Message - From: "Fastream Technologies" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Tuesday, August 29, 2006 10:30 AM Subject: [twsocket] Need help with THttpCli reuse after abort() : Hello, : : As you know I am coding a reverse proxy. In my proxy, I am keeping HTTP : CLIENT connections open after a request so that the next request does not : wait for the establishment. Now, when something goes wrong (i.e. socket : error), I abort the client connection as well to reset the internal state : machine. However, when I do so, in the next request, (which needs to reopen : the socket) it stalls at SocketDataAvailable. It goes to httpwaitingheader : part but reads data instead of header and cannot find the #10 so exits. This : was not the case when we did not have a cache and did not feel the need to : send HEAD command before GET. Now it stalls at HEAD!! : : Any idea? : : Best Regards, : : SZ : : -- : To unsubscribe or change your settings for TWSocket mailing list : please goto http://www.elists.org/mailman/listinfo/twsocket : Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Need help with THttpCli reuse after abort()
Hello, As you know I am coding a reverse proxy. In my proxy, I am keeping HTTP CLIENT connections open after a request so that the next request does not wait for the establishment. Now, when something goes wrong (i.e. socket error), I abort the client connection as well to reset the internal state machine. However, when I do so, in the next request, (which needs to reopen the socket) it stalls at SocketDataAvailable. It goes to httpwaitingheader part but reads data instead of header and cannot find the #10 so exits. This was not the case when we did not have a cache and did not feel the need to send HEAD command before GET. Now it stalls at HEAD!! Any idea? Best Regards, SZ -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be