Re: [Rabbit-proxy-development] Getting Contentlength
Brought to you by:
ernimril
From: Robert O. <ro...@kh...> - 2007-01-08 21:44:13
|
Ingo Schr=F6der wrote: > I will try to do the suggested workaround tomorrow. So by implementing=20 > the TrafficLogger I would get some more traffic then the real size of=20 > the resource. This would be ok. I would test and maybe get a feeling fo= r=20 > the difference. You may get a larger size, yes. Uploads that have a known content length=20 (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=20 > (con.getTrafficHandler().getClient().getAmount() for example?) And what= =20 > would it show me if i use it from a filter (httpInFilter in my case). I= s=20 > the complete resource / byte count available at that moment? Or should = i=20 > 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 |