First, i have not read the messages you write this follow up to. > This is a follow up. I wanted to report what appears to be a > related issue to the bug in THttpCli when a link is > redirected. It seems that the RequestDone is called twice. > This has already been reported and I've implemented a work > around in my program.
If you get data together with the redirection, mabe it is not a bug that you get requestdone twice? > I've discovered another issue in that it doesn't seem that > the RcvdStream is being cleared. For example, when a link is > requested using THttpCli and it is redirected, there can be > garbage at the beginning of RcvdStream. > RcvdStream should only contain the document obtained from the > redirected link and nothing from the original link that > caused the redirection. > > I am using the latest release version and C++Builder 6. > > I have reproduced this problem in my application using this > link provided by a user: > http://net1test.rhmware.com/marketingprimer > > I have worked around this issue by clearing RcvdStream when > the LocationChange event is called using: > if (HttpCli->RcvdStream) { > HttpCli->RcvdStream->Seek(0,soFromBeginning); > } If LocationChange is triggered before you have received all the data from first request, maybe you should clear the stream in requestdone instead,? > > By the way, I hope the above is sufficient to clear the > stream but I'm not sure that it is. If it isn't can anyone > state the correct way to clear/reset a steam? I can't find it > in the documentation. This only sets the position in the stream, in this case to the start of the stream. Then when you receive data, the data is written from the start of the stream, overwriting previous data if there are any. If you use a TMemoryStream, you can use Clear or SetSize, this will also delete old data. You can also delete the stream and make a new stream. Regards Bjørnar -- 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