Re: [Rabbit-proxy-development] Getting Contentlength
Brought to you by:
ernimril
From: <isc...@gm...> - 2007-01-08 21:59:07
|
Hello Robert, for my assurance. Calling the method from the connection when filtering it would bring the part of bytes transferred by this connection. And afterwards this counter would be set to null and by the next time only the new amount would be available. So by saving the connection to a database and using some sql i would get the slightly higher amount. Is that correct so far. This would solve my problem. Ingo Robert Olofsson schrieb: > Ingo Schröder wrote: >> I will try to do the suggested workaround tomorrow. So by >> implementing the TrafficLogger I would get some more traffic then the >> real size of the resource. This would be ok. I would test and maybe >> get a feeling for the difference. > > You may get a larger size, yes. Uploads that have a known content > length (and it usually is) will send the correct amount. Chunked > transfers > are usually done in something like 512b/2k/larger buffers and then you > have a chunk header that usually is something like: "\r\n200\r\n" > >> Having not used the TrafficLogger, how would i get it >> (con.getTrafficHandler().getClient().getAmount() for example?) And >> what would it show me if i use it from a filter (httpInFilter in my >> case). Is the complete resource / byte count available at that >> moment? Or should i get the right data later? And from what starting >> point? > > IF you follow my idea you will get calls to read(long) with the amount > of data just read. You have to keep track of how much you have read > (similar to how SimpleTrafficLogger does it). > It will be the amount of data the connection have seen this far in the > handling of this resource. If you check the Connection.logConnection > method you will see that after each call the proxy statistics are > updated and then the connection clears its statistics (to be ready for > the next request). > > /robo > |