On Thu, Jan 5, 2012, at 16:15, Will Manley wrote: > The tests that I added to my branch[1] fail because Polipo seems to try > to revalidate all it's resources when the size of the resource > (Content-Length) >= CHUNK_SIZE. > > If the cache is flushed to disk between the first and second requests > polipo will behave correctly and not try to revalidate the resource.
So it turned out to be a bug in `objectHasData`. The function takes a bytes range as a parameter or from=0 to=-1 if all of the data is to be fetched. "to" is corrected later in the function to be the expected length of the data, but before this the index of the last chunk of this data is calculated (i.e. to % CHUNK_SIZE, e.g. -1 % CHUNK_SIZE == 0). This is the correct index for data that fits in 1 chunk, but is incorrect otherwise. This is why this bug would only exhibit when (Content-Length < CHUNK_SIZE). This bug would cause the function to then check if the same data was available on disk which would succeed if it had already been flushed out of the memory cache. The fix is on a branch on github. Try: git pull git://github.com/wmanley/polipo.git fix-unconditional-revalidation All the tests in my test branch pass with this patch applied. Thanks Will ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Polipo-users mailing list Polipo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/polipo-users